This page is a quick-and-dirty command reference for NG-BASIC, the Javascript BASIC interpreter.

IF..THEN..ELSE IF condition THEN statement ELSE statement

Conditionally execute a BASIC statement. A statement may also be a line number, in which case GOTO will automatically be executed.

Examples:
IF A>5 THEN 510 ELSE GOSUB 1000
10 IF A>2 OR B=1 THEN 250 ELSE GOSUB 500

GOTO GOTO line

Used for flow control, to directly go to another place in the program.Examples:
GOTO 100

GOSUB GOSUB line

Go to a sub-routine at line. When the statement RETURN is encountered, program execution continues from the GOSUB statement.

Examples:
GOSUB 100

RETURN RETURN

Flow control, used to jump back to the GOSUB that we came from.

Examples:
RETURN

FOR..NEXT Go to a sub-routine at line. When the statement RETURN is encountered, program execution continues from the GOSUB statement.

Examples:

10 FOR I=1 TO 200 STEP 10
20 PRINT I
30 NEXT I
40 END

INPUT INPUT [quoted question] variable

Used for user input, and can also be used for printing a question to the terminal.

Examples:
100 INPUT "What is your name", NAME$
110 PRINT "Hi ";NAME$;", what is your age?"; : INPUT AGE

PRINT PRINT [quoted string]

Go to a sub-routine at line. When the statement RETURN is encountered, program execution continues from the GOSUB statement.

Examples:
100 PRINT "Hi there"
120 PRINT NAME$;" this is the ";COUNT;"th time."

String Functions
LINES( ), TAB( ), STR( ), RIGHT( ), LEFT( ), MID( )
Numeric Functions
LEN( ), VAL( ), GETKEY( ),