VBScript Operators

In previous lessons, we've used the "equals" operator to assign a value to a variable. We've also used it to perform a test against a given condition (for example, the If statements).

In VBScript, operators are used to perform an operation. For example, an operator could be used to assign a value to a variable. An operator could also be used to compare two values.

Below is a listing of VBScript operators and a brief description of them. Don't worry if you don't understand all of them at this stage - just bookmark this page for reference and return whenever you need to.

Artithmetic Operators

Operator

Description

+

Addition

-

Subtraction

*

Multiplication

/

Division

\

Integer Division (divides two numbers and returns an integer result)

Mod

Modulus (remainder of a division)

^

Exponentiation (raises the number to the power of an exponent)

Assignment Operator

Operator

Description

=

Assign

Comparison Operators

Operator

Description

=

Is equal to

<>

Is not equal to

>

Greater than

>=

Greater than or equal to

<

Less than

<=

Less than or equal to

Logical Operators

Operator

Description

And

Performs a logical conjunction on two expressions (if both expressions evaluate to True, result is True. If either expression evaluates to False, result is False)

Or

Performs a logical disjunction on two expressions (if either or both expressions evaluate to True, result is True).

Not

Performs logical negation on an expression.

Xor

Performs a logical exclusion on two expressions (if one, and only one, of the expressions evaluates to True, result is True. However, if either expression is Null, result is also Null).