STEP

From C64-Wiki
Jump to navigationJump to search
BASIC keyword
Keyword: STEP
Abbreviation: S, T, Shift+E
Type: Keyword part
Token code: 169/$A9
Handling routine
in BASIC ROM:
42901–42910
$A795–A79E
List of all BASIC keywords


Remark: This article describes the BASIC keyword STEP in BASIC V2 at the Commodore 64.

Type: Keyword part 

In Commodore BASIC V2, the keyword STEP is used in contexts of a FOR...TO...STEP...NEXT loop construction (for short: FOR...NEXT loop). This keyword has to be followed by an numerical expression which is evaluate only once and will be stored for later usage in stepping through the FOR loop variable. The default value is 1 if STEP is omitted. Even a value of 0 is allowed which builds an infinite loop, but such one can be forced to terminate if the loop variable is explicitly set to the end value introduced by the TO keyword.

Important: This keyword may not used as a variable name or be a part of it. If the keyword STEP is encountered in any other context the BASIC error ?SYNTAX ERROR occurs.

Examples[edit | edit source]

Infinite loop with a forced exit:

110 FOR E=0 TO 1 STEP 0
120 GET C$: PRINT C$;
130 IF C$=CHR$(13) THEN E=1
140 NEXT

Read keys character by character and show them until the RETURN key is pressed.


Further examples

See also examples for BASIC commands


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