FN FuNction
Function
FN calls a user-defined function. It is always used in conjunction with DEF FN, which defines the function to be called.
How to use FN
If a numeric function is to be called, FN is followed by a letter and then a pair of brackets. If any parameters are to be passed to the function, then these are each separated by a comma and enclosed in brackets, for example
170 LET x=FN r(3,4)
The parameters are then passed to the function called "r". FN then returns the result. If no parameters are to be passed, then the pair of brackets must still be included, for example
70 PRINT FN r()
In this case, the function uses the values currently assigned to its variables.
FN calls a string function the same way, except that $ must be added after the letter (see DEF FN).
FN does work recursively, but care should be taken not to cause an infinite recursion and eventual memory waste.
Format
- FN letter ([num-expr] [,num-expr])
- FN letter$ ([string-expr] [num-expr] [,num-expr] [,string-expr])
See also