Operators
- Updated2024-09-12
- 1 minute(s) read
VBScript Language Directory > Operators
Operators
Use operators to assign values to variables and to execute calculations and comparisons.
When you use several operators in an expression, note that VBS normally processes the operators from left to right. The following rules apply: VBS first evaluates arithmetic operations, then comparisons, and finally logical operations. Use parentheses if you want to override this order of precedence. VBS evaluates operations inside parentheses before the operations outside the parentheses. Inside the parentheses the above rules apply.
If the VBS processes the operations "Result = 4 + 5 * 6 + 7" according to precedence, the result of the first example is the value 41. By adding parentheses to "Expression Result = (4 + 5) * (6 + 7)", VBS executes the addition first. The result is then 117.
Arithmetic Operators
Symbol | Function |
Exponentiation | ^ |
Unary negation | - |
Multiplication | * |
Division | / |
Integer number division | \ |
Modulo arithmetic | mod |
Addition | + |
Subtraction | - |
Character string link | & |
Comparison Operators
Symbol | Function |
Equality | = |
Inequality | <> |
Smaller than | < |
Greater than | > |
Less than or equal to | <= |
Greater than or equal to | >= |
Object equivalence | is |
Logical Operators
Symbol | Function |
Logical negation | not |
Logical conjunction | and |
Logical disconjunction | or |
Logical exclusion | xor |
Logical equivalence | eqv |
Logical implication | imp |