Expand description
§Statements
Statements describe what the program does. The original Dartmouth BASIC
was separated into a compiler and operating system with statements like GOTO
and PRINT for the compiled language and commands like SAVE and LIST
for controlling the system. 64K BASIC is a unique implementation where
everything is compiled and executed by a virtual machine. There are no
commands, everything is a statement.
Statements tend to be short and it’s common to put multiple statements on a
single line. Use a colon : to separate statements. This works in both
direct and indirect modes.
FOR I = 1 TO 10 : PRINT I : NEXT IStatement words can never be used in variable names. 64K BASIC will insert spaces to help you when you accidentally include a word in a variable name.
LET BONK = 1
10 LET B ON K = 1Statements need to be properly formatted with the information they need.
Angled brackets <> are used to indicate required items.
Square brackets [] are used to indicate optional items.
Ellipsis ... indicate items that may repeat.
Vertical bars | separate mutually exclusive options.
All letters and punctuation not in brackets are required.
Modules§
- CLEAR
CLEAR [...]- CLS
CLS- CONT
CONT- DATA
DATA <literal>[,<literal>...]- DEF
DEF FN<name>(<argument>[,<argument>...]) = <expression>- DEFTYPE
DEFINT/SNG/DBL/STR <range of letters>- DELETE
DELETE [<line number range>]- DIM
DIM <variable name>(<dimensions>)[,...]- END
END- ERASE
ERASE [<array variable>][,<array variable>...]- FOR
FOR <variable>=<x> TO <y> [STEP <z>]- GOSUB
GOSUB <line number>- GOTO
GOTO <line number>- IF
IF <expression> THEN <statements> [ELSE <statements>]- INPUT
INPUT [,]["<prompt string>";]<variable>[,<variable>...]- LET
[LET] <variable>=<expression>- LIST
LIST [<line number range>]- LOAD
LOAD <filename>- MID
[LET] MID$(<string>,n[,m])=<expression>- NEW
NEW- NEXT
NEXT [<variable>][,<variable>...]- ON
ON expression <GOTO|GOSUB> <line>[,<line>...]PRINT [<list of expressions>]- READ
READ <variable>[,<variable>...]- REM
REM [<anything>]or' [<anything>]- RENUM
RENUM [<new number>][,<old number>][,<increment>]- RESTORE
RESTORE [<line number>]- RUN
RUN [<line number>|<filename>]- SAVE
SAVE <filename>- STOP
STOP- SWAP
SWAP <variable>,<variable>- TRON
TRON | TROFF- WHILE
WHILE <expression> : WEND