Basic
With numeric data, relational operators compare
2
pieces of data
and the result is either
true
orfake. If the relationship is true, BASIC
returns
-1.
If
the relationship
is
false, BASIC returns
0
(zero).
Relational operators are usually used within an IFlTHEN statement.
For example, the command:
IF
A
=
1
THEN PRINT llCORRECT1i
displays the word CORRECT if the variable A is equal to
1.
With string data, relational operators compare character by
character. When
2
characters do not match, BASIC checks to see
which character has the lower ASCII value. The character with the
lower value comes before the word with the higher value. Leading
blanks are significant in string comparisons. The ASCII code for
blank is
32.
PRINT
"A"
<
rlB1l
compares the ASCII value of the
2
strings. The ASCII value for A
is
65,
and the ASCII value for B is
66.
Because
65
is less than
66,
BASIC returns
-1.
Tandy
1000
13