|(if A or B is 100 then the result is true)|
|(A = 96)|
|(if X>=Y the result is true)|
|(result is -97 (two's complement))|
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:
|K%=1 AND M<>X|
|K%=2 OR (A=B AND M<X)|
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.|