Logical Operators
Logical Operators
result
expression1
Any expression.
expression2
Any expression.
The And operator also performs a bitwise comparison of identically positioned bits in two numeric
expressions and sets the corresponding bit in result according to the following table:
And bit in expression2
If bit in expression1 is The result is
is
0 0 0
0 1 0
1 0 0
1 1 1
NOT OPERATOR
result
expression
Any expression.
Remarks
True False
False True
Null Null
In addition, the Not operator inverts the bit values of any variable and sets the corresponding bit in
result according to the following table:
0 1
1 0
OR OPERATOR
result
expression1
Any expression.
expression2
Any expression.
Remarks
If either or both expressions evaluate to True, result is True. The logical operation is not short-
circuited. All expressions are evaluated.
The Or operator also performs a bitwise comparison of identically positioned bits in two numeric
expressions and sets the corresponding bit in result according to the following table:
0 0 0
0 1 1
1 0 1
1 1 1
XOR OPERATOR
result
expression1
Any expression.
expression2
Any expression.
Remarks
If one, and only one, of the expressions evaluates to True, result is True. However, if either expression
is Null, result is also Null. When neither expression is Null, result is determined according to the
following table:
If expression1 is And expression2 is Then result is
The Xor operator also performs a bitwise comparison of identically positioned bits in two numeric
expressions and sets the corresponding bit in result according to the following table:
0 0 0
0 1 1
1 0 1
1 1 0
IS OPERATOR
result = object1 Is object2
Arguments
result
object1
object2
If object1 and object2 both refer to the same object, result is True; if they do not, result is False. Two
variables can be made to refer to the same object in several ways.
In the following example, A has been set to refer to the same object as B:
Copy
Set A = B
Copy
Set A = C
Set B = C
EQV OPERATOR
Used to perform a logical equivalence on two expressions.
result
expression1
Any expression.
expression2
Any expression.
If either expression is Null, result is also Null. When neither expression is Null, result is determined
according to the following table:
If expression1 is And expression2 is The result is
The Eqv operator performs a bitwise comparison of identically positioned bits in two numeric
expressions and sets the corresponding bit in result according to the following table:
0 0 1
0 1 0
1 0 0
1 1 1
IMP OPERATOR
Used to perform a logical implication on two expressions.
result
expression1
Any expression.
expression2
Any expression.
The Imp operator performs a bitwise comparison of identically positioned bits in two numeric
expressions and sets the corresponding bit in result according to the following table:
0 0 1
0 1 1
1 0 0
1 1 1
The value of 1 is true and 0 is false in vbscript.