Functions
Named functions
let square x = x * x // Function with 1 parameter
let res = square 2 // Returns 4
// (1) Parentheses required for annotations of type
let square' (x: int) : int = x * x
// (2) Brackets required when deconstructing an object
// (here it's a single-case discriminated union π
let hotelId (HotelId value) = valueFunctions of 2 or more parameters
Functions without parameter
Multi-line function
Anonymous function
_.Member shorthand (Fβ― 8)
Naming convention related to functions
Piping
Pipeline: chain of pipings
If/then/else expression
Match expression
Last updated