Standard Dartmouth BASIC Commands


CommandDefinition

data object {, object}

Defines data objects used in the read statements.

dim var (array1, {,array2{,array3}})

Defines dimensions for a group of arrays. The maximum number of dimensions permitted for an array is three.

end

Terminates the execution of a program.

exit

Terminates the execution of a script.

for x = e1 to e2 {step e3}

Starts execution of a loop. Loop execution is controlled by x, which ranges from e1 to e2 and is incremented by 1 (or optionally e3) for each repetition of the code in the loop.

goto n

Transfers control to the specified line.

if exp then s1 {else s2}

Tests an expression, exp, for a true or false value and transfers control to s1 if exp is true and to s2 if exp is false.

let x=exp

Assigns the value of an expression to a variable. If there is no command on a line, BASIC assumes a let.

next {x {,y}}

Defines the end of the for loop.

print #f list

Outputs the values in list to the file identified in #f. The values in list are a comma-separated series of constants, variables, and expressions.

print list

Prints the values in list. The values are a comma-separated series of constants, variables, and expressions.

read var {,var}

Reads data objects from data statements contained in the program.

rem or ` `

Defines a comment. The BASIC interpreter NLM ignores comments when it interprets the script.

restore {1 @p}

Restores the data pointer to the first object in the data list. This allows the subsequent read statement to begin reading at the start of the data list.

return

Returns from a subroutine to the line following the gosub subroutine call.

stop

Stops execution of the script.

tgosub l

Transfers control to the subroutine defined at the specified line.