Chapter 6 RAPID!
Commands
168 WCDMA Options Version 6.20
FUNCTION – EXIT FUNCTION –
END FUNCTION
Description
Deletes a variable and releases the memory used.
This command is useful to keep memory consumption of
a program as low as possible. Especially large variable
arrays or long string variables should be erased as soon
as they are no longer required.
Note: Local variables are automatically erased at the ter-
mination of the related procedure or function.
Example
ERASE Journal$
Syntax
FUNCTION fnName [$] ( [ parameter
[{, parameter } ]] )
[ instructions ]
fnName [$] = fnExp
[ EXIT FUNCTION ]
END FUNCTION
Parameters
fnName is a valid name for the function (same syntax
rules apply as for variable names),
parameter may be any valid numeric or string expres-
sion,
instructions are an (optional) number of program
lines,
fnExp is an expression (of the same data type as the
function itself).
Description
Declares a function (
FUNCTION ... END FUNCTION).
Functions are commonly used to e.g. calculate the result
of mathematical expressions.
After a function has been declared, it may be called by its
name
fnName.
A function call must contain all parameters in the same
order as specified in the function’s declaration.
The return value of a function will either be a numeric
expression (in case of
fnName) or a string expression (in
case of
fnName$).
A function may call itself recursively.
All variables used in a function are local unless declared
as
GLOBAL (please see below for details).
All parameters are treated as local.
Using the
EXIT FUNCTION command, you may leave
any function at any place or condition (e.g. in case a
value exceeds a certain limit, the function exits and
passes on control to an error handling system).