EasyManua.ls Logo

Radio Shack TRS-80 Model 3 - Page 131

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...
Stringoperations:
I
+
,
<,>,
=,<=,>=,<>
Forexample, in the line:
X*X + 5[2.8
BASIC will find the value
of
5 to the 2.8 power. Next, itwill multiply X *x, and
finally add this value to the value
of
5 to the
2.8.
If
you want BASIC to perform the
indicatedoperations in a different order, you must add parentheses. For
example:
X*
(X + 5 [2.8)
or
X*
(X +
5)
[2.8
Here's
anotherexample:
IF
X = 0
OR
Y>O
AND
2=1
THEN 255
Therelational operators =
and>
have the highest precedence, so BASIC
performs themfirst, one after the next, from leftto right. Then the logical
operations are performed.
AND has a higherprecedence than
OR,
so BASIC
performs the AND operationbefore
OR.
If
the above line looks confusing because you
can't
remember which operator is
precedentoverwhich, then you can use parentheses to make the sequence
obvious:
IF
X=
0
OR
((Y>
0)
AND
(2 = 1))
THEN 255
1/27

Related product manuals