The following table summarizes the Visual Basic logical operators.
Operator | Purpose | Example | Result |
---|---|---|---|
Not | Logical or bitwise negation | Not A | True if A is false |
And | Logical or bitwise And | A And B | True if A and B are both true |
Or | Logical or bitwise Or | A Or B | True if A or B or both are true |
Xor | Logical or bitwise exclusive Or | A Xor B | True if A or B but not both is true |
AndAlso | Logical or bitwise And with short-circuit evaluation | A AndAlso B | True if A and B are both true |
OrElse | Logical or bitwise Or with short-circuit evaluation | A OrElse B | True if A or B or both are true |