FN

From C64-Wiki
Jump to: navigation, search
BASIC keyword
Keyword: FN
Abbreviation: ./.
Type: Function
Token code: ---/---
Handling routine
in BASIC ROM:
---;---
$----;----
List of all BASIC keywords


Remark: This article describes the BASIC-Command FN in BASIC V2 on the Commodore 64.

Type: Numeric function
General Programming-Syntax: FN <function name>(numeric argument)

The BASIC-command FN executes a function which has been defined previously in the course of the program with the BASIC-command DEF. After the definition the function can also be executed by the command PRINT FN Y(X). The space between FN and the name of the function can be omitted.

If the definition via DEF is missing or not executed before the use of FN, the interpreter will report an "?UNDEF'D FUNCTION ERROR". If the numeric argument X is missing, the interpreter will answer "?SYNTAX ERROR". An "?OUT OF MEMORY ERROR" can also occur if the function has been defined recursively. It is possible to use different functions within one operation as in the final example given below.

Examples[edit]

PRINT FN TEST(3) (direct execution after previous definition via DEF !!)
PRINT FN LO10(A) 
PRINT FN X(9.873)
10 A = FN DATEN1 (X) - FN JAHR2(Y)
20 H=H+1: IF FN TE3 (H+1) = 6 THEN 20 (execution within a program)
30 A=FN X(FN Y(Z))
BASIC V2.0 (second release) Commands

ABS | AND | ASC | ATN | CHR$ | CLOSE | CLR | CMD | CONT | COS | DATA | DEF | DIM | END | EXP | FN | FOR | FRE | GET | GET# | GOSUB | GOTO | IF | INPUT | INPUT# | INT | LEFT$ | LEN | LET | LIST | LOAD | LOG | MID$ | NEW | NEXT | NOT | ON | OPEN | OR | PEEK | POKE | POS | PRINT | PRINT# | READ | REM | RESTORE | RETURN | RIGHT$ | RND | RUN | SAVE | SGN | SIN | SPC | SQR | STATUS/ST | STEP | STOP | STR$ | SYS | TAB | TAN | THEN | TIME/TI | TIME$/TI$ | TO | USR | VAL | VERIFY | WAIT