Functions

func

Start a function definition.

Syntax

define func <name>(<type> <arg>, ...);
  ...
end;
define func <name>(<type> <arg>, ...) returning <type>;

How she behaves

  • The return type is optional. Add returning <type> if you want it written down.
  • If you skip returning, the variable you assign the result to must already be the right type.
  • Parameters are typed and local to the function.

Example

define func sub(num x, num y) returning num;
  return x - y;
end;

See also