65 
•  Logical operation 
Logical operation 
The task of giving YES 
or 
ON results,  by judgment, are not few 
in 
computers.  Here 
let 
us 
consider some  logical  expressions  used  to  judge  some conditions.  The logical 
operators 
NOT, AND, 
OR 
and 
XOR 
are used 
in 
logical expressions. 
CD 
X AND Y (logical product =  and) 
AND means X moreover Y 
XY 
X and Y 
1  1  1 
1 
0  0 
0 
1  0 
0  0  0 
®  NOT X (negation =  not) 
Means that it 
is 
not X 
NOT 
X 
o 
® X 
OR 
Y (logical addition =  inclusive or) 
OR 
means either X 
or 
Y 
XY 
XORY 
1  1 
1 
1 
0 
1 
0 
1  1 
0 
0  0 
@  X 
XOR 
Y (Exclusive logical addition = 
exclusive or) 
Means X and 
Y are not equal 
XY 
XXORY 
1  1 
0 
1  0 
1 
0  1 
1 
0  0 
0 
The  logical  operation 
is 
usually  used  in 
IF 
-
THEN 
- ELSE command,  explained 
before.  For instance, it 
is 
used as follows: 
• 
IF 
-30<X 
AND 
Y>20 
THEN 
120 
ELSE 
100 
(The meaning above 
is: 
if the X value 
is 
-30<X 
moreover 
Y>29 
go to line number 
120, 
if not jump to line 
100) 
• 
IF 
-30<X 
OR 
Y>20 
THEN 
10 
ELSE 
100 
(The meaning above 
is: 
if the X value 
is 
-30<X 
or 
Y>20 
to to line number 120, if 
not jump to line 
100).