Logical Operators

Top  Previous  Next

 

The logical operators act only upon "boolean" variables, namely, true or false.

 

The logical operator NOT allows users to evaluate conditions that are best expressed in a negative way.  Basically, it reverses the logical value of the condition on which it operates.

 

Variable        Not(Variable)        

false                true        

true                false        

 

The And logical operator is a comparison operator between two or more boolean variables.  It returns true if both conditions are true.

 

Variable A        Variable B        A and B        

false                false                false        

true                true                true        

false                true                false        

true                false                false        

 

The Or logical operator is a comparison operator between two or more boolean variables.  It returns true if either of the conditions are true.

 

Variable A        Variable B        A or B        

false                false                false        

true                true                true        

false                true                true        

true                false                true        

 

The Xor logical operator is a comparison operator between two or more boolean variables.  It returns true only if one of the conditions are true.

 

Variable A        Variable B        A xor B        

false                false                false        

true                true                false        

false                true                true        

true                false                true