Logical Operators
Previous  Top  Next


The logical operators act just upon "boolean" variables, namely, just two values, true or false.
 
The Not logical operator acts upon a variable and denies it:

Variable   Not(Variable)   
false   true   
true   false   

The And logical operator is a comparison operator between two or more variables, it returns true if both variables 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 variables, it restores true if one of the variables is 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 variables, it restores true only if one of the variable is true.

Variable A   Variable B   A xor B   
false   false   false   
true   true   false   
false   true   true   
true   false   true