Radio Shack TRS-80 PC-3 Owner's Manual page 220

Table of Contents

Advertisement

APPENDIX D EXPRESSION EVALUATION AND OPERATOR PRIORITY
When the Radio Shack PC-3 Pocket Computer is given a complex expression, it evaluates the parts of the expression in a sequence
which is determined by the priority of the individual parts of the expression. If you enter the expression:
100/5+45
as either a calcu lation or as a part of a program, the PC-3 Computer does not know if you mean:
100
5 + 45
=2
or
~+45
=65
5
Since the PC-3 Computer must have some way to decide between these options, it uses its rules of operator priority. Because
division has a higher "priority" than addition (see belowl, it will choose to do the division first and then the addition, i.e., it will
choose the second option and return a value of 65 for the expression.
Operator Priority
Operators on the Ratio Shack PC-3 Computer are evaluated with the following priorities from highest to lowest:
1. Parentheses
2. Variables and Pseudovariables
3. Exponentiation (...... ) when preceded by a multiplication which omits the operator
4. Multiplication which omits the operator
5. Functions
6. Exponentiation (...... )
223

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents