Computers also do a simple and primitive type of logic called Boolean Logic, the idea of
True and False, or 1(sometimes -1) and 0. The True and False are used as words, more like
values, in the script, like this: A = True. It understands it this way and
processes it with a few special commands, called operators: AND, OR, XOR, NOT, =, <>, <,
>,<=, >=
AND will return true only if both values are true:
True AND True is True
True AND False is False
False AND False is False
OR will return true only is on value is true:
True OR True is True
True OR False is True
False OR False is False
XOR operator is used to perform a logical exclusion on two expressions,
they return True only when the two part disagree:
True XOR True is False
True XOR False is True
False XOR True is True
False XOR False is False
NOT just reverses the ideas; this one's simple:
NOT True is False
NOT False is True
The previous words work only on the level of True and False, but there are logical
words for testing numbers.
= for equals to, returns True if both values are alike:
3 = 5 is False
4 = 4 is True
5 = 3 is False
<> for not equal to, returns True if both values are unlike:
3 <> 5 is True
4 <> 4 is False
5 <> 3 is True
< for less than, returns True if the first value is lower than the second:
3 < 5 is True
4 < 4 is False
5 < 3 is False
<= for less than or equal to, returns True if the first value is lower than or the
same as the second:
3 <= 5 is True
4 <= 4 is True
5 <= 3 is False
> for greater than, returns True if the first value is higher than the second:
3 > 5 is False
4 > 4 is False
5 > 3 is True
>= for greater than or equal to, returns True if the first value is higher than or
the same as the second:
3 >= 5 is False
4 >= 4 is True
5 >= 3 is True
By: Matthew Holder