In a simple expression there is only one operator so no precedence considerations arise. The calculation is performed according to the operator.
In a compound expression, the evaluation proceeds from left to right with operators being processed according to the standard rules of precedence. So, in a compound expression such as:
(2 + 3 * 4 ** 2)
there are three operators, which are processed in the order:
Exponentiation
Multiplication
Addition
The expression is therefore processed in three steps as follows:
4 ** 2=16 16 * 3=48 48 + 2=50
So an assignment statement coded as:
&A = (2 + 3 * 4 ** 2)
results in &A being assigned a value of 50.
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |