F# - Basic Try catch pattern

Post date: Dec 29, 2011 10:48:29 PM

The basic try catch pattern is very neat. You only need to match your expected exception type and you are done!

let GetNum x = try let res = 100 / x res with | :? System.DivideByZeroException -> -1 | :? System.OverflowException -> -2