DEF
PURPOSE:
To define a user function.
STATEMENT SYNTAX:
{stno} DEF FNx (arg list)={expr}or{str expr}
or multi line function
{stno} DEF FNx (arg list)
...
...
{stno} RETURN {expr}or{str expr}
{stno} FNEND
where:
FNx = a FUNCTION NAME which uniquely defines the DEF statement. "x" represents any
combination of characters or numeric digits which could make up a valid variable name.
arg list = a list of variables that will be assigned the value of the variable in the
corresponding position of the calling FNx. The argument list variables are generally unique
since they are stored in the same data area level as the caller's variables.
Choosing a naming convention for your substitution variables such as in example
2000 and 3000 below (using '__' as a postfix) can prevent accidental variable conflicts.
EXAMPLE:
0100 DEF FNA$ (A$,B$,C$) = A$+B$+C$
2000 DEF FNX_ROUND (A__) = INT(A__ + .5)
3000 DEF FNX_TIME$ (T__) = 3000:STR (T__:"00") +":"+ STR (60*(T__-INT(T__):"00"
NOTES:
The DEF function name must end in a '$' if the result to be return is a string.
SEE:
FNx and FNEND