THEN

From C64-Wiki
Jump to navigationJump to search
BASIC keyword
Keyword: THEN
Abbreviation: T, Shift+H
Type: Keyword part
Token code: 167/$A7
Handling routine
in BASIC ROM:
???–???
$????–????
List of all BASIC keywords


Remark: This article describes the BASIC keyword THEN in BASIC V2 of the Commodore 64.

Type: Keyword part 

In Commodore BASIC V2, the keyword THEN is used in contexts with a IF...THEN... construct.


Important: A THEN must not be part of a variable name, otherwise the BASIC error message ?SYNTAX  ERROR IN line occurs.


Examples[edit | edit source]

  • Numerical evaluation and subsequent assignment:
10 IF A>=B THEN C=A
  • Numerical evaluation and output:
10 IF D<0 THEN PRINT "It's a negative number!"
40 GET A$: IF A$="" THEN 40

Remark: 40 GET A$: IF A$="" GOTO 40 is faster.


  • For other examples see IF.
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