fork(1) download
  1. let safeDiv num den : Choice<string, float> =
  2. if den = 0. then
  3. Choice1Of2 "divide by zero"
  4. else
  5. Choice2Of2 (num / den)
  6.  
  7. match safeDiv 15. 3. with
  8. | Choice1Of2 msg -> printfn "%s" msg
  9. | Choice2Of2 x -> printfn "%f" x
  10.  
Success #stdin #stdout 0.03s 18980KB
stdin
Standard input is empty
stdout
5.000000