
Note: You must add uk to the end of the address, it's to help prevent spam. |
DEF TYPE: Statement Action: This sets up a user-defined function that can be used later in the program. The function can consist of any mathematical formula. User defined functions save space in programs where a long formula is used in several places. The formula need only be specified once, in the definition statement, and then it is abbreviated as a function name. It must be executed once, but any subsequent executions are ignored. The function name is the letters FN followed by any variable name. This can be 1 or 2 characters, the first being a letter and the second a letter or digit. EXAMPLES of DEF FN Statement:
The function is called later in the program by using the function name with a variable in parentheses. This function name is used like any other variable, and its value is automatically calculated, EXAMPLES of FN Use:
In line 50 above, the number 9 inside the parentheses does not affect the outcome of the function, because the function definition in line 20 doesn't use the variable in the parentheses. The result is Y times Z, regardless of the value of X. In the other two functions, the value in parentheses does affect the result. |