VBScript Operator
VBScript has a complete set of operators, including Arithmetic Operators, comparison operators, join operators, and logical operators.
Operator priority
When an expression contains multiple operators, each part is calculated in a predetermined order, which is called the operator priority. You can use parentheses to overwrite the priority order and force some parts of the expression to be calculated first. During operation, operators in parentheses are always executed first, and then operators outside parentheses are executed. However, the standard operator priority is still observed in parentheses.
When an expression contains multiple operators, the arithmetic operators are calculated first, then the comparison operators are calculated, and finally the logical operators are calculated. All comparison operators have the same priority, that is, the comparison operators are calculated from left to right. The priority of Arithmetic Operators and logical operators is as follows:
Arithmetic Operators |
|
Comparison Operators |
|
Logical operators |
|
Description |
Symbol |
Description |
Symbol |
Description |
Symbol |
Power |
^ |
Equal |
= |
Non-logical |
Not |
Negative number |
- |
Not equal |
<> |
Logic and |
And |
Multiplication |
* |
Less |
< |
Logic or |
Or |
Division |
/ |
Greater |
> |
Logic exclusive or |
Xor |
Division |
\ |
Less than or equal |
<= |
Logical equivalence |
Eqv |
Remainder |
Mod |
Greater than or equal |
> = |
Logical implicit |
Imp |
Add |
+ |
Object Reference comparison |
Is |
|
|
Subtraction |
- |
|
|
|
|
String connection |
& |
|
|
|
|
When the multiplication and division numbers appear in the same expression at the same time, the multiplication and division operators are calculated from left to right. When addition and subtraction appear in an expression at the same time, the addition and subtraction operators are calculated from left to right.
The String concatenation (&) operator is not an arithmetic operator, but in the priority order, it is placed after all Arithmetic Operators and before all comparison operators.IsAn operator is an object reference comparison operator. It does not compare the values of objects or objects, but only checks whether two objects reference the same object.