Exercises - Priority Of Operators - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

Using Expressions
3. Compute all operations within parentheses from left to right
4. Logical AND
5. Inclusive OR

Exercises - Priority of Operators

1. What are the answers to the following examples?
2. In the example of the student and the college from "Exercises - Using Logical
ANSWERS
1. The results are as follows:
2. I'll consider it.
36
z/OS V1R1.0 TSO/E REXX User's Guide
v Exponential operation
IF (8 > 7**2) & (2 < 3) | (8||2 = 10) THEN ...
\____/
49
v Concatenation operation
IF (8 > 49) & (2 < 3) | (8||2 = 10) THEN ...
IF (8 > 49) & (2 < 3) | (82 = 10) THEN ...
\____/
\___/
0
1
0
&
1
|
0
\_______/
0
0
|
0
\_____________/
0
a. 22 + (12 * 1)
b. -6 / -2 > (45 % 7 / 2) - 1
c. 10 * 2 - (5 + 1) // 5 * 2 + 15 - 1
Expressions" on page 34, if the parentheses were removed from the student's
formula, what would be the outcome for the college?
IF inexpensive | scholarship & reputable | nearby THEN
SAY "I'll consider it."
ELSE
SAY "Forget it!"
Remember the college is inexpensive, did not offer a scholarship, is reputable,
but is 1000 miles away.
a. 34
(22 + 12 = 34)
b. 1 (true)
(3 > 3 - 1)
c. 32
(20 - 2 + 15 - 1)
The & operator has priority, as follows, but the outcome is the same as the
previous version with the parentheses.
IF inexpensive | scholarship & reputable | nearby THEN
\_________/
\_________/
true
false
\
\___________/
\
\_________________/
true
\____________________/
\____/
82
\_____/
0
\_______/
\____/
true
false
/
false
/
/
/
true

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents