The function syntax is fairly simple. The basic form of a function is:
function ( argument list )
{
statements
}
If a syntax error is encountered while the function is being entered (read), definition of the function must begin again from the very beginning.
There are several statements that only make sense within functions:
global ( global-var-1, global-var-2 ... )local ( local-var-1, local-var-2 ... )
return expression
The global
and local
statements are optional. There
are no restrictions on the number of local
or global
statements or where they occur in the function. However, since
these two statements only affect variables that are used after the declaration, it is recommended that you use local
and global
at the beginning of each function.
The return
statement is also optional. There are no
restrictions on the number of return statements, or their
placement. A function can return from any point in its
execution. The return statement must return a value. The value can
be any RLaB object.