Functions
This part covers the full declaration surface of functions: parameter modifiers, default parameters, named arguments, variadic parameters and spread calls, overloads, and generic constraints.
Functionfunc declares a function. The return annotation is optional; omit it and the function returns void. When a function returns a value you must write -> T, and the type returned by return is checked strictly against the declaration.
Lambdas and ClosuresA lambda is an anonymous function value. The syntax comes in a short family and a complete family, and once it captures outer local variables it becomes a closure. Reach for one when you need a callback or a small one-off function without inventing a name.
PipelinesThe pipeline operators pass the value on the left to the function on the right as an argument, so data transformations line up left to right in reading order. All four pipeline operators share the |> mark; a prefix or suffix distinguishes the semantics:
Const FuncA const func is a function the compiler can evaluate at compile time: the compiler executes the function body during compilation and materializes the result as a constant. It has two faces — ordinary function and constant capability: at runtime it is called as usual, and in constant contexts the compiler interprets its body.
Last updated on October 11, 2026
