Numeric Relations
This is the meaning
of
the operators when you use them to compare numeric
expressions:
<
>
<>
or
><
=<
or
<=
=>
or >
Less than
Greaterthan
Equal to
Not equal to
Less than or equal to
Greaterthan or equal to
Examples
of
true relational expressions:
1<2
2<>5
2<=5
2<=2
5>2
7=7
StringRelations
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:
<
>
><
or
<>
<=
>=
Precedes
Follows
Hasthe same precedence
Does not havethe same precedence
Precedes or has the same precedence
Follows or has the same precedence
BASIC compares the string expressions on a character-by-characterbasis. When
it finds a non-matching character, it checks to see which character has the lower
ASCII code. The characterwith the lowerASCII 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 B
it's
66.
"CODE"
<
"COOL"
1/23