IF
A$
<
B$
THEN
50
if string A$ alphabetically precedes string
B$,
then the program
branches to line
50.
IF
R$
= "YES"
THEN
PRINT
A$
if R$ equals YES then the message stored as A$
is
printed.
However, you may also use relational expressions simply to return the
true or false results of a test. For example:
PRINT
7 = 7
prints - 1 since the relation tested
is
true.
PRINT
"A"
> "B"
prints 0 because the relation tested is false.
Logical Operators
Logical operators make logical comparisons. Normally, they are used
in
IFtTHEN statements to make a logical test between two or more
relations. For example:
IF A = 1
OR
C = 2
THEN
PR
I
NT
}{
The logical operator, OR, compares the two relations A = 1 and
C
=
2.
Logical operators may also be used to make bit comparisons of two
numeric expressions.
For this application, BASIC does a bit-by-bit comparison of the two
operands, according to predefined rules for the specific operator.
NOTE: The operands are converted to integer type, stored internally
as 16-bit, two's complement numbers. To understand the results of
bit-by-bit comparisons, you need to keep this
in
mind.
The following table summarizes the action of Boolean operators
in
bit
manipulation.
2-44