` IF A=100 OR B=100 THEN 20 ` (if A or B is 100 then the result is true) ` A=64 OR 32: PRINT A ` (A = 96) ` IF NOT X=Y the result is true) ` X= NOT 96 ` (result is -97 (two's complement))

### HIERARCHY OF OPERATIONS

All expressions perform the different types of operations according to a fixed hierarchy. In other words, certain operations are performed be- fore other operations. The normal order of operations can be modified by enclosing two or more operands within parentheses ( ), creating a "subexpression." The parts of an expression enclosed in parentheses will be reduced to a single value before working on parts outside the parentheses.

When you use parentheses in expressions, they must be paired so that you always have an equal number of left and right parentheses. Otherwise, the BASIC error message ?SYNTAX ERROR will appear.

Expressions which have operands inside parentheses may themselves be enclosed in parentheses, forming complex expressions of multiple levels. This is called nesting. Parentheses can be nested in expressions to a maximum depth of ten levels-ten matching sets of parentheses. The inner-most expression has its operations performed first. Some examples of expressions are:

 A+B C^(D+E)/2 ((X-C^(D+E)/2)*10)+1 GG\$>HH\$ JJ\$+"MORE" K%=1 AND M<>X K%=2 OR (A=B AND M

The BASIC Interpreter will normally perform operations on expressions by performing arithmetic operations first, then relational operations, and logical operations lost. Both arithmetic and logical operators have

 This page has been created by Sami Rautiainen. Read the small print. Last updated November 13, 1998.