Vbscript| Basic Tutorial | Operation VBScript has a complete set of operators, including arithmetic operators, comparison operators, join operators, and logical operators.
Operator Precedence
When an expression contains more than one operator, each part is evaluated in a predetermined order, which is called the operator precedence. You can use parentheses to cross this order of precedence, forcing some parts of an expression to be evaluated first. Operation, the operator in parentheses is always executed first, and then the operators outside the parentheses are executed. However, the standard operator precedence is still followed in parentheses.
When an expression contains more than one operator, the arithmetic operator is evaluated first, the comparison operator is computed, and the logical operator is finally computed. All comparison operators have the same precedence, that is, the comparison operator is computed in left-to-right order. The precedence of arithmetic operators and logical operators is as follows:
Arithmetic operators |
Comparison operators |
logical operators |
Describe |
Symbol |
Describe |
Symbol |
Describe |
Symbol |
exponentiation |
^ |
Equals |
= |
Logical non |
Not |
Minus sign |
- |
Not equal to |
<> |
Logic and |
and |
By |
* |
Less than |
< |
Logical OR |
Or |
Except |
/ |
Greater than |
> |
Logical XOR or |
Xor |
Divisible |
\ |
Less than or equal to |
<= |
Logical equivalence |
Eqv |
Find Yu |
Mod |
Greater than or equal to |
>= |
Logical implied |
Imp |
Add |
+ |
Object reference Comparison |
Is |
|
|
Reducing |
- |
|
|
|
|
string concatenation |
& |
|
|
|
|
When multiplication and division appear in an expression at the same time, the multiply, except operators are computed in left-to-right order. Also, when addition and subtraction appear in an expression, the addition and subtraction operators are computed from left to right.
The string concatenation (&) operator is not an arithmetic operator, but in the order of precedence, it is ranked after all arithmetic operators and before all comparison operators. The IS operator is an object reference comparison operator. It does not compare the values of objects or objects, but simply checks to see whether two object references refer to the same object.