Function
Defines a function with the specified parameters and return value. If this function is a global, it can be called by clicking a placeholder and selecting or typing its name. When the function is selected, placeholders for each of the parameters will be added to the function call.
Syntax
function ([parameter1] [parameter2] …)
[result]
- parameter1-N
- One or more parameters separated by spaces.
- result
- The result of the function.
Example
The code below defines the factorial function recursively in a global named Factorial.
function (n)
if
· <=
· n
· 1
· 1
· *
· n
· Factorial
· -
· n
· 1
This function can then be called from within any other global like in the following example:
Factorial
· 5
In this case, the resulting value would be 120.