EasyManua.ls Logo

Radio Shack TRS-80 Model 3 - Page 130

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-80 MODEL III
Hierarchy
of
Operators
When yourexpressions have multiple operators, BASIC performs the operations
according to a well-defined hierarchy, so that results are always predictable.
Parentheses
When a complexexpression includes parentheses, BASIC always evaluates the
expressions inside the parentheses before evaluating the rest
of
the expression.
Forexample, the expression:
8 -
(3-2)
is evaluated like this:
3 2 = 1
8 - 1 = 7
Withnested parentheses, BASIC starts evaluating the innermost level first and
works outward.
For
example:
4 * (2 -- (3 -
4)
)
is evaluated like this:
3-4=
-1
2-(-1)=3
4*3
= 12
Order
ofOperations
When evaluating a sequence
of
operations on the same level
of
parenthesis,
BASIC uses a hierarchyto determine what operation to do first.
The two listings below show the hierarchy
BASIC uses. Operators are shown in
decreasing order
of
precedence. Operators listed in the same entry in the table
have the same precedence and are executed as encountered
from left to right:
Numerical operations:
[ or (Exponentiation)
+ , (Unary sign operands
[not
addition and subtraction])
*, /
+ , (Addition and subtraction)
<, >,
=,
<=, >=,
<>
NOT
AND
OR
1/26

Related product manuals