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

The '=' operator behaves as an assignment the first time it's
encountered in an assignment, and equality at all other times. Thus,
'A=B=C' sets A to 1 (true) if B is equal to C, 0 otherwise. This is
significantly different from a number of other languages. However, 'IF
A=B THEN x' does not set the value of A to B. The "not equals" test is
'<>' or '><'.

Integers are automatically promoted to reals when needed. To do the
reverse, use 'varb=INT(expr)'. That converts the value to the highest
integer less than or equal to the expression. Integer values have a
fixed range of -32767 to 32767, so trying to convert from outside that
range will result in an error.

Boolean operators are also available-- integers and reals are treated
as true or 1 if not zero, and false or 0 if zero. Thus, 'A%=5.0 AND 2'
is true. The only boolean operations available are 'NOT', 'AND' and
'OR'

Bitwise operations are not directly supported, even on integers.

Operators have the following precedence; things within the same
precedence level are evaluated left to right:
* Highest precedence: () [parentheses]
* ^ [exponentiation]
* - [unary minus]
* * [multiplication], / [division]
* + [addition], - [subtraction]
* = [equal], <> or >< [not equal], < [less than], > [greater than],
<= or =< [less than or equal], >= or => [greater than or equal]
* NOT [logical complement]
* AND [logical AND]
* Lowest precedence: OR [logical OR]

Applesoft is somewhat concerned about variable types-- if you try and
directly assign a string to a number or vice versa, it'll stop and
complain. There are single-character conversions such as
'varb$=CHR$(varb2)' and 'varb=ASC(varb2$)'. Also, for string to number
coverstions, there is 'var$=STR$(expr)' (converts number to string
form) and 'val=VAL(expr$)' (converts first number found in string to
numeric value)

2.2 String expressions and Assignments

Strings have their own sets of operations-- the '+' operator acts to
concatenate strings, so 'A$=B$+C$' sets A$ to the full text of B$
followed immediately by the full text of C$, no spaces in between.
[Also assuming that the resulting size of A$ is under the limit of 255
characters per string, otherwise there'd be an error.] You can also
use '=', '<>' and the rest of the arithmatic comparisons on strings.
Note that string comparisons are case sensitive, and normal ASCII
order is used. The end of a string is considered to be less than any
character, in case of comparing strings of unequal length.

The individual characters in a string are not immediately accessible,
but can be gotten without too much trouble. 'LEN(expr$)' is the length
in characters of a string (can be a single string or any expression of
string type); 'LEFT$(varb$,n)' returns the n leftmost characters in
the variable, if n is greater than the length of the string, it
returns the entire string. Similarly 'RIGHT$(varb$,n)' is the n
rightmost characters. 'MID$(varb$,start[,len])' starts 'start'
characters into the string, and returns the "len" characters after
that, or the rest of the string if len is not specified. If "start" is
greater than the length of the string, the null string is returned.