View contents of this chapter

Logical Operators


Operator Description Example Result
And Both sides must be true (2<3) And (4 < 9) True
Or One side or other must be true (2<3) Or (5>10) True
Xor One side or other must be true but not both (2<3) Xor (2<6) False
Not Negates truth Not (5=5) False


The following table shows a complete order of operators. It shows how conditional and logical operators work in conjunction with mathematical operators when they all appear in the same expression.

Order Operators
1 Parentheses
2 ^
3 *, /, \, Mod
4 +, -
5 Conditional Operators including Like
6 Not logical operator
7 And
8 Or
9 Xor

Play Sound To make you program clear and more readable, add parentheses around expressions to reduce ambiguity with their order of operation.

 



© Universal Teacher Publications        INDEX Previous Screen Next Screen