BASIC
Numeric Relations
This is the meaning
expressions:
of the operators when you use
them
to
compare numeric
<
Less
than
>
Greater than
=
Equal to
<>
or
><
Not equal to
=
<
or
<
=
Less
than or equal to
=
>
or
>
=
Greater than or equal to
Examples of true relational expressions:
1<2
2<>5
2<=5
2<=2
5>2
7
=
7
String Relations
The relational operators for string expressions are the same as above, although
their
meanings are slightly different. Instead of comparing numerical magnitudes,
the
operators compare their
ASCII
sequence. This allows you
to
sort string
data:
<
Precedes
>
Follows
=
Has the same precedence
><
or
<>
Does not have the same precedence
<
=
Precedes or has the same precedence
>
=
Follows or has the same precedence
BASIC compares
the string expressions on
a
character-by-character basis.
When
it finds
a
non-matching character, it checks to see
which
character
has the lower
ASCII code
.
The character with the lower ASCII code is the smaller
(precedent) of
the two strings.
Note:
The appendix
contains a listing of
ASCII codes
for each character.
Examples of
true
relational
expressions:
"A" < "B"
The ASCII code for A is decimal
65;
for Bit's 66.
"CODE"
<
"COOL"
117