Skip to content

Latest commit

 

History

History
30 lines (18 loc) · 540 Bytes

File metadata and controls

30 lines (18 loc) · 540 Bytes

Option.either

Namespace: FsToolkit.ErrorHandling

Function Signature

Provide two functions to execute depending on the value of the option. If the option is Some, the first function will be executed. If the option is None, the second function will be executed.

('T-> 'output) -> (unit -> 'output) -> 'T option -> 'output

Examples

Example 1

Option.either (fun x -> x * 2) (fun () -> 0) (Some 5)

// 10

Example 2

Option.either (fun x -> x * 2) (fun () -> 0) None

// 0