statement/DEF statement/DEF
NAME
DEF FN -- Defines a function
ABBREVIATION
d <shift> E
SYNOPSIS
DEF FN <fnc_name>(<variable>)=<expression>
FUNCTION
This command allows you to define a complex calculation as a function.
In the case of a long formula that is used several times within a
program, this can save a lot of space.
The name you give the numeric function begins with the letters FN,
followed by any legal numeric variable name (<fnc_name>). First you must
define the function by using the statement DEF followed by the name
(<fnc_name>) you've given the function. Following the name is a set of
parentheses () with a numeric variable (<variable>) enclosed. Then you
have an equal sign, followed by the formula (<expression>) you want to
define. You can call the formula, substituting any number for a variable
(<variable>).
INPUTS
<fnc_name> - name of the function
<variable> - variable name used in the formula
<expression> - formula
RESULT
Defines a function to be used within a program.
EXAMPLES
10 DEF FNA(X)=12*(34.75-X/.3)+X
20 PRINT FNA(7)
The number 7 is inserted each place X is located in the formula
given in the DEF statement.
NOTES
DEF FN can only be used with standard numeric functions, not integer or
string functions.
BUGS
None
SEE ALSO
None