74
The
VIC
20
User
Guide
IF
X < Y OR B > =
44
THEN F = 0
F
is
set to 0 if X
is
less than Y or B
is
greater than
43
IF
A = 1 AND B = 2 OR C = 3 GOTO
30
Take the branch if both A = I and B =
2;
also take
the branch if
C
=3
A single operand can be tested for true
or
false. An operand appearing
alone has
an
implied
"<
>0"
following it. Any nonzero value
is
considered
true; a zero value
is
considered false.
IF
A THEN
B=
2
IF
A < > 0 THEN B = 2
The above two statements are equivalent
IF
NOT B GOTO
100
Branch if B
is
false, i.e., equal to zero. This
is
probably better written as
IFB=
o GOTO
100
All Boolean operations use integer operands.
If
you perform Boolean
operations using floating point numbers, the numbers are automatically
converted to integers. Therefore, the floating point numbers must fall within
the allowed range
of
integer numbers.
If
you are a novice programmer, you are unlikely to use Boolean
operators in the manner that
we
are
about
to describe.
If
you do not
understand the discussion, skip to the next section.
TABLE
3·3. Boolean Truth Table
The AND operation results in a 1 only if both numbers are 1
I
AND I = I
o AND 1 = 0
I
ANDO=
0
o
ANDO=
0
The OR operation results in a 1 if either number
is
I
lOR
1 = 1
o
OR
1 = 1
lOR
0 = 1
OORO=
0
The NOT operation logically complements each number
NOT 1 = 0
NOTO=
1