FNx() Function - Execute User-Defined Function
Syntax
FNnumname(expr,...)
FNstrname(expr,...)
Description
Used with the DEF verb, the FN() function executes
functions defined by the user.
Because the argument list on the define is only prepared to accept simple variables, a string dimensioned to a template will only pass the value of the string to the receiving variable and not the template definition. In addition, an array reference may only contain a single element of an array and not pass an entire array. If a procedure requires passing arguments by reference, it should use the interface defined by the CALL verb.
Examples
Example 1
The following converts decimal hours to minutes:
0100 DEF FNTIME$(X)=STR(INT(X)-12*(INT(INT(X)/13)
0100:))+":"+STR(INT(FPT(X)*60))":00"
>PRINT FNTIME$(TIM)
12:56
Example 2
The following inserts slashes in the date:
0100 DEF FNDATE$(X$)=X$(1,2)+"/"+X$(3,2)+"/"+X$(5,2)
>PRINT FNDATE$("091596")
09/15/96