The DEF statement consists of a statement number, the keyword DEF and the function definition. The function definition consists of the function name, followed by an equal sign, followed by a constant, variable, or expression. If the function requires an argument, then it must appear immediately after the function name, enclosed in parentheses. The following example shows how a function to convert Fahrenheit to Celsius could be defined.
Numeric functions return numeric values and string functions return string values.
String functions must consist of three letters followed by a dollar sign. The expression in a DEF statement is evaluated only when the defined function is referenced. If the execution of a program reaches a line containing a DEF statement, it proceeds to the next line with no other effect. A function definition can reference other defined functions, but not itself. A function may be defined only once in a program.