map2
Namespace: FsToolkit.ErrorHandling
Apply a function to the values of two options if they are Some. If either option is None, return None.
Function Signature
('TInput1 -> 'TInput2 -> 'TOutput) -> 'TInput1 option -> 'TInput2 option -> 'TOutput optionExamples
Example 1
Option.map2 (fun x y -> x + y) (Some 1) (Some 2)
// Some 3Example 2
Option.map2 (fun x y -> x + y) (Some 1) None
// NoneExample 3
Option.map2 (fun x y -> x + y) None (Some 2)
// NoneLast updated