Logical Operator

The following table illustrates the description and symbols of logical operators:

Table 11-3 Logical Operators

Description Symbols
Logical negation Not
Logical conjunction And
Logical disjunction Or
Logical exclusion Xor

The following examples illustrates the use of the Logical operator:

Example 1:

Dim A, NotA
A = True
NotA = Not A   ' Logical negation: Not True
'NotA: Not True is False

Example 2:

Dim B, C, AndResult
B = True
C = False
AndResult = B And C   ' Logical conjunction: True And False
'AndResult: True And False is False

Example 3:

Dim D, E, OrResult
D = True
E = False
OrResult = D Or E   ' Logical disjunction: True Or False
'OrResult: True Or False is True

Example 4:

Dim F, G, XorResult
F = True
G = False
XorResult = F Xor G   ' Logical exclusion: True Xor False
'XorResult: True Xor False is True