RUN (BASIC)

From C64-Wiki
Jump to navigationJump to search
Disambiguation The title of this article is ambiguous. RUN (Disambiguation).
BASIC keyword
Keyword: RUN
Abbreviation: R Shift+U
Type: Command
Token code: ???/$??
Handling routine
in BASIC ROM:
?????–??????
$????–????
List of all BASIC keywords


Remark: This article describes the BASIC command RUN in BASIC V2 of the Commodore 64.

Typ: Command
General Programming-Syntax: RUN [<line number>]

The BASIC command RUN starts a BASIC program. When no line number is given, the program will start at the first line number. By starting with RUN the stack is deleted, while the BASIC command CLR is executed automatically in the background.

When RUN is given a line number, it will start the program at this line number. If this line number does not exist, the BASIC error message ?UNDEF'D STATEMENT ERROR IN line will be displayed.

RUN can be used in BASIC programs.

The program keeps running until the last line is reached, the commands END, NEW or STOP are executed, the key <RUN/STOP> is pushed or a BASIC error occurs.

Stopped programs can be restarted and continued without deleting the stack using CONT or GOTO [<line number].

Examples[edit | edit source]

10 INPUT "Which Game you want to start (1 or 2)";A$
20 A = VAL(A$)
30 IF A<1 OR A>2 THEN RUN: REM by wrong key- restart
40 IF A=1 THEN RUN 10000: REM gamestart in line 10000
50 IF A=2 THEN RUN 20000: REM gamestart in line 20000
60 END
10000 PRINT "You have started game 1": END
20000 PRINT "You have started game 2": END
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