Using Logical Operators
Logical operators work strictly with Boolean (that is, True/False) operands. The And operator, for example, is useful for determining if two True/False conditions are both True. Table 4-6 lists the complete set of logical operators that Visual Basic .NET provides.
Table 4-6. Visual Basic .NET Logical Operators
Operator |
Mode |
Result |
---|---|---|
Not |
Unary |
True if operand is False False if operand is True |
And |
Binary |
True if both operands are True False if either operand is False |
Or |
Binary |
True if either operand is True False if both operands are False |
Xor |
Binary |
True if exactly one operand is True False if both operands are True or False |
AndAlso |
Binary |
Same as And but short-circuited |
OrElse |
Get Faster Smarter Beginning Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.