These define a procedure or function, which is a set of one or more lines of script.
define procedure <procedurename> . . end define
and
define function <functionname> . . end define
A procedure can be called anywhere using the do script command.
Calling a function is almost exactly the same as calling a variable - you just put the function name inside "$" signs within a parameter. For example, the following would return whatever value was output by the function "myfunction":
msg <MyFunction returned $myfunction$.>
A function returns a value using the return command somewhere within the function definition block:
return <value>
You can pass parameters to functions and procedures by enclosing them within brackets after the function or procedure name and separating them (if there are more than one) with semicolons. For example, to pass parameters of "3", "potato" and "sausage" to a function named myfunction, you'd call it in a parameter containing:
$myfunction(3;potato;sausage)$
To pass these same parameters to a procedure called myprocedure, use the script command:
do <myprocedure(3;potato;sausage)>
To see what parameters a function or procedure has been passed, see the Parameter Functions section.
- see the script commands section for script commands that can be included in a procedure or function.