0 people like it.

Option.getOrDefault

Safe get for the Option type

1: 
2: 
3: 
4: 
let getOrDefault ``default`` option =
    match option with
    | Some x -> x
    | None -> ``default``
val getOrDefault : default:'a -> option:'a option -> 'a

Full name: Script.getOrDefault
Multiple items
val option : 'a option

--------------------
type 'T option = Option<'T>

Full name: Microsoft.FSharp.Core.option<_>
union case Option.Some: Value: 'T -> Option<'T>
val x : 'a
union case Option.None: Option<'T>
Raw view Test code New version

More information

Link:http://fssnip.net/s2
Posted:9 years ago
Author:let rec
Tags: option