[Home] [Console] [Guide] [Applications] [Index] [Back]

sub(), block()

A sub(program) is a sequence of expressions, each separated by the colon ( : ) symbol, to be evaluated in linear order. The sequence is wrapped in curled braces ( { } ) as occulted code. The sub prefix triggers subprogram evaluation, as in sub({exp1:exp2:exp3:...}).

Subprograms have private scope: variables created before the sub call are still "visible" inside the subprogram, whereas variables created inside the subprogram vanish as the subprogram finishes.

The output of a subprogram is specified by whichever expressions are prefixed by the print_ statement. This special keyword is analogous to "return" in C-family languages. There must be at least one print_ statement in a subprogram.

A (code)block is a subprogram with public scope: variables created or altered inside a codeblock are maintained after exit.

Test Window

Output Window