F# keyword 'Some' - what does it mean?
Some
is not a keyword. There is an option
type however, which is a discriminated union containing two things:
Some
which holds a value of some type.None
which represents lack of value.It's defined as:
type 'a option =
| None
| Some of 'a
It acts kind of like a nullable type, where you want to have an object which can hold a value of some type or have no value at all.
let stringRepresentationOfSomeObject (x : 'a option) =
match x with
| None -> "NONE!"
| Some(t) -> t.ToString()