Primitive type: function

Primitive type: function

Overview

The scripting language allows you to define custom functions.

Syntax

A piece of code enclosed in curly braces defines a function.

A function can be called using parentheses, for example function(argument:value).

Composition

Functions can be composed using the + operator, evaluating a + b first evaluates a and uses its result as input for b:

 example := to_upper + { "result == {input}" }
 example("xyz") == "result == XYZ"

Multiple functions can be changed together like this, this is especially convenient in combination with default arguments.

Example

 example := { a + b }
 example(a: 1, b: 2) == 3