Operators
Operators precedence
When several operations occur in an expression, each part is evaluated and resolved in a predetermined order called operator precedence. You can use parentheses to override the order of precedence and force some parts of an expression to be evaluated before others. Operations within parentheses are always performed before those outside. Within parentheses, however, standard operator precedence is maintained.
When expressions contain operators from more than one category, arithmetic operators are evaluated first, comparison operators are evaluated next, and logical operators are evaluated last. Comparison operators all have equal precedence; that is, they are evaluated in the left-to-right order in which they appear. Arithmetic and logical operators are evaluated in the following order of precedence.
Operators precedence
When several operations occur in an expression, each part is evaluated and resolved in a predetermined order called operator precedence. You can use parentheses to override the order of precedence and force some parts of an expression to be evaluated before others. Operations within parentheses are always performed before those outside. Within parentheses, however, standard operator precedence is maintained.
When expressions contain operators from more than one category, arithmetic operators are evaluated first, comparison operators are evaluated next, and logical operators are evaluated last. Comparison operators all have equal precedence; that is, they are evaluated in the left-to-right order in which they appear. Arithmetic and logical operators are evaluated in the following order of precedence.
Arithmetic | Comparison | Logical | |||
Description | Symbol | Description | Symbol | Description | Symbol |
Exponentiation | ^ | Equality | = | Logical negation | Not |
Unary negation | - | Inequality | <> | Logical conjunction | And |
Multiplication | * | Less than | < | Logical disjunction | Or |
Division | / | Greater than | > | Logical exclusion | Xor |
Integer division | \ | Less than or equal to | <= | Logical equivalence | Eqv |
Modulus arithmetic | Mod | Greater than or equal to | >= | Logical implication | Imp |
Addition | + | Object equivalence | Is | ||
Subtraction | - | ||||
String concatenation | & |