EasyManua.ls Logo

Radio Shack TRS-80 Model 3 - Page 128

Radio Shack TRS-80 Model 3
276 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
TRS-SO
MODEL III
The ASCII code for 0 is 79; for D
it's
68.
If
while making the comparison,
BASIC
reaches the end
of
one string before
finding non-matching characters, the shorterstring is the precedent. For
example:
"TRAIL" < "TRAILER"
Leading and trailing blanks are significant. Forexample:
"A"
< "A"
ASCII for the space characteris 32; for A,
it's
65.
"Z
-
aD"
<
"Z
aDA"
The string
on
the left is four characters long; the string on the right is five.
How to Use Relational Expressions
Normally, relational expressions are used as the test in an IF/THEN statement. For
example:
IF
A = 1 THEN PRINT "CORRECT"
BASIC
tests to see
if
A is equal to 1.
If
it is, BASICprints the message.
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. Forexample:
PRINT
7'
= 7
Prints - 1since the relation tested is true.
PRINT
"A"
> "B"
Prints 0 because the relation tested is false.
1/24

Related product manuals