[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

an order of precedence (or hierarchy of operations) within themselves. On the other hand, relational operators do not have an order of precedence and will be performed as the expression is evaluated from left to right.

If all remaining operators in an expression have the same level of precedence then operations happen from left to right. When performing operations on expressions within parentheses, the normal order of precedence is maintained. The hierarchy of arithmetic and logical operations is shown in Table 1-3 from first to last in order of precedence.

Table 1-3. Hierarchy of Operations Performed on Expressions
^ Exponentiation BASE ^ EXP
- Negation (Unary Minus) -A
* Multiplication AB * CD
/ Division EF / GH
+ Addition CNT + 2
- Subtraction JK - PQ
> = < Relational Operations A <= B
NOT Logical NOT
(Integer Two's Complement)
AND Logical AND JK AND 128
OR Logical OR PQ OR 15


Strings are compared using the same relational operators (=, <>, <=, >=, <, >) that are used for comparing numbers. String comparisons are mode by taking one character at a time (left-to-right) from each string and evaluating each character code position from the PET/ CBM character set. If the character codes are the same, the characters are equal. If the character codes differ, the character with the lower code number is lower in the character set. The comparison stops when

[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated November 13, 1998.