[ Back ]

Functions are very much like procedures. The difference is that they're treated as expressions and therefor must return values. Unless the function is of integer type, its type must be added after its name, the same way as for variables.

function name[type]([parameter 1[, parameter 2 ...]])
  return expr

The return statement exits the function and returns the expression. return, but without an expression, can also be used to exit a procedure. Ex:

function Double#(a#)
  return a#*2.0

function ArrayOfTwo[](a, b)
  return [a, b]

A function call is always an expression, and its parameters must be within paranthesis. Ex:

doubled# = Double(2.0)
array[] = ArrayOfTwo(3, 72)

[ Back ]