A function call consists of the name of a function, the passing of values to the function and optionally using the return value. The return value can be used in an expression, written to a variable or ignored.
Passing values
Values are passed to the parameters of the function. A value can be passed as a variable or as a result of an expression.
If a parameter holds a reference, then the function can change the contents of the variables refered to.
Return value
The return value is either:
- used in an expression, e.g. as in the line
g(f(x) + 1)
. - written to a variable, e.g. as in the assignment
a = f(x)
. - ignored, e.g. as in the line
f(x)
.
Special limitations
- If the return value is an array, it must be assigned to a variable before passed as input to another function.
- If an argument is a character that is passed to a decimal, it must be assigned to a variable before passed as an argument. This is to detect the typecast. This will most likely be fixed in a future version.
Example
The following calls the function named f
and sets the parameters to a+1
, b
and c*3
.
f(a+1, b, c*3);