Commodore 2001-8 User Manual page 129

Table of Contents

Advertisement

Appendix B.
BASIC STATEMENTS
DEF FN
DIM
END
FOR·TO-STEP·NEXT
GET
GOSUB-RETURN
GOTO
IF·THEN
INPUT
LET
ON-{GOSUB-GOTO)
POKE-PEEK
PRINT
READ-DATA-RESTORE
REM
STOP-CONT
WAIT
In the following description of statements, an argument of V or W denotes a numeric variable. X denotes
a numeric expression, X$ denotes a string expression and an lor
J
denotes an expression that is
truncated to an integer begore the statement is executed. Truncation means that any fractional part of
the number is lost, e.g. 3.9 becomes 3, 4.01 becomes 4.
DEF
100 DEF FNA (V)=VIB+C
B-1
The user can define functions like the
built-in functions (SOR, SGN, ASS, etc)
through the use of the DEF statement. The
name of the function is 'FN' followed by
any legal variable name, for example: FNX,
FNJ7, FNKO, FNR2. User-furnished
functions are restructed to one line.
A
function may
be defined to be any
expression, but may only have one
argument. In the example, B & Care
variables that are used in the program.
Exe~uting
the DEF statement defines the
function. User-defined functions can be
redefined by executing another DEF
statement for the same function.
User-defined string functions are not
allowed. 'V' is called the dummy variable.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pet 2001-8

Table of Contents