Apple II User Manual

Page of 257
    (5 plus 3/4).
The precedence of operators used in evaluating expressions is as follows, in order beginning with the
highest precedence :
                NOTE
        Operators listed on the same line have the same
        precedence.
1)  Expressions in parentheses are always evaluated first
2)  ^ (F3 KEY)                  ExponentiatiOn
3)  NEGATION                    -X where X may be a formula
4)  * and /                     Multiplication and Division
5)  + and -                     Addition and Subtraction
6)  RELATIONAL OPERATORS:               =               Equal
    (equal precedence for all six)      <>              Not Equal
                                        <               Less Than
                                        >               Greater Than
                                        =< or <=        Less Than or Equal
                                        => or >=        Greater Than or Equal
                                (These three below are Logical Operators)
7)  NOT                         Logical and bitwise "NOT" like
                                negation, not takes only the formula
                                to its right as an argument
8)  AND                         Logical and bitwise "AND"
9)  OR                          Logical and bitwise "OR"
A relational expression can be used as part of any expression.
Relational Operator expressions will always have a value of True (-1) or a value of False (0).
Therefore, (5=4)=0, (5=5)=-1, (4>5)=0, (4<5)=-1, etc.
The THEN clause of an IF statement is executed whenever the formula after the IF is not equal to 0.
That is to say, IF X THEN ... is equivalent to IF X<>0 THEN ....
    SYMBOL          SAMPLE STATEMENT                PURPOSE/USE
    ------          ----------------                -----------
    -               10 IF A=15 THEN 40              Expression Equals Expression
    <>              70 IF A<>0 THEN 5               Expression Does Not Equal Expression
    >               30 IF B>100 THEN 8              Expression Greater Than Expression
    <               160 IF B<2 THEN 10              Expression Less Than Expression
    <=,=<           180 IF 100<=B+C THEN 10         Expression Less Than or Equal To
                                                    Expression
    >=,=>           190 IF Q=>R THEN 50             Expression Greater Than Or Equal To
                                                    Expression
    AND             2 IF A<5 AND B<2 THEN 7         If expression 1 (A<5) AND expression 2
                                                    (B<2) are both true, then branch to
                                                    line 7
    OR              IF A<1 OR B<2 THEN 2            If either expression 1 (A<1) OR
                                                    expression 2 (B<2) is true, then branch
                                                    to line 2