1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

'END' will stop execution of the currently running program and cleanly
exit to the Applesoft prompt. Contents of variables are still set and
can be read. 'STOP' halts the currently running program with a
message; you can use 'CONT' from the prompt to attempt to restart
where you left off. In either case, a 'POKE 51,0: GOTO n' will attempt
to jump to a specified line in the code. [The 'POKE 51,0' tricks
Applesoft into thinking a program is running; INPUTs and other
deferred mode only commands won't work from the prompt without that.]

2.4 Variable names & conventions

All variables are identified by their first two characters and an
optional extension denoting the variable type. The first character
must be a letter, A-Z. The second can be blank (giving essentially a
single-letter variable name), A-Z, or 0-9. All continuing characters
([A-Z0-9]) past the first two are ignored-- NA is the same as NAME.
The total variable name has a maximum of 238 characters. [Applesoft's
236 character per line limit will restrict what you could do with such
long names.]

After the variable name, a character can be used to override the
default type of floating point [range of approx +/- 1.7*10^38 to
+/-2.29388*10^-39] variable. Use '$' to specify a string (255
characters maximum), or '%' for an integer (16 bits, with range -32767
to 32767). These three types are independent-- assigning to NM% will
not affect NM$ or NM. Also, all variables are assumed to be 0 (real
and integers) or an empty string if they are accessed before a value
is written to them.

When you type in your program, keywords are parsed before your
variable names, so do not use a keyword at anywhere in the variable
name. 'FORMATION=5' parses as 'FOR M AT I ON =5' which won't work when
run.

To extend these basic types, you can make arrays. To do this, do a
'DIM varname(size [, size [,size...]])' before using the array, where
size is an integer size greater than zero. Unlike C, DIM A(10) gives
you eleven places: A(0), A(1), A(2)... A(10). The values in each
position in the array can be set or read by giving the array variable
name, and the subscript in parentheses; this subscript can be
specified on the fly. For example 'DIM A(10): FOR X=1 TO 10: A(X)=X:
NEXT'. The subscript is converted to an integer value on accessing, as
the above example shows.

The size does not need to be a constant in the code-- you can do
'A%=50: DIM B(A%)'. Arrays can be of integer, real, or string type.
The presence of an array does not affect the basic (nonarray)
variable: A(x) for all x is independent from A.

If an array is referenced before being DIM'd, Applesoft assigns the
array a size of 11 (0-10), and it cannot be redimensioned.

You can make multidimensional arrays by specifying them in the DIM; a
3x3x3 integer array can be created by doing 'DIM B%(2,2,2)'. Please
note the section on Applesoft's memory management, as trying to
allocate too much memory for an array can overflow Applesoft's pool of
at most 35K.