Operators in VBScript
In VBScript the following applies in terms of the precedence of operators. Arithmetic operators are evaluated first. Comparison operators are evaluated second. Logical operators are evaluated last. All comparison operators have equal precedence and are evaluated left-to-right as encountered. Arithmetic operators are evaluated in the order of the table displayed below.
Arithmetic Operators
| Operator | Purpose |
|---|
| ^ | exponentation : raises a number to a power |
| - | unary negation |
| * | multiplication |
| / | division |
| \ | integer division : returns the integer part of a division (truncation) |
| MOD | modulo : returns the remainder of a division |
| + | addition |
| - | subtraction |
| & | string concatenation |
The Is operator is an object reference comparison operator. The Is operator compares object references and if those references refer to a single object. The Is operator does not compare values of objects.
Comparison Operators
| Operator | Purpose |
|---|
| = | equal |
| <> | not equal |
| < | less than |
| > | greater than |
| <= | less than or equal to |
| >= | greater than or equal to |
| Is | equivalent object |
Logical Operators
| Operator | Purpose |
|---|
| Not | Logical negation |
| And | Logical conjunction |
| Or | Logical disjunction |
| Xor | Logical exclusion |
| Eqv | Logical equivalence |
| Imp | Logical implication |