@function parameters @then body @endfunction @function a @then b @endfunction

Makes a function. The comma-separated list of parameters goes after the function\\keyword, and the body of the function goes after the @then. Functions are very often used with @define, which allows you to name and re-use the function.

If the function you need is very simple and uses its parameter once, you may find the quest syntax useful.

ExamplesClick an example to insert it
@define low = @function(a, b) @then @if a < b @then a @else b @endif @endfunction @then low(3, -5) @enddefine-5
apply each([2,3,4], @function(x) @then x * x @endfunction)[4,9,16]