next up previous contents
Next: Control Flow Up: Expressions and Assignment Previous: Operator Precedence

Precedence Example

It is easy to make mistakes by forgetting the implications of precedence, the following expression,

    x = a+b/5.0-c**d+1

is equivalent to

    x = ((a+(b/5.0))-(c**d))+1

Likewise the following expression,

    .NOT.A.OR.B.EQV.C.AND.D.OR..NOT.E

is equivalent to

    ((.NOT.A).OR.B).EQV.((C.AND.D).OR.(.NOT.E))

Parentheses can be added to any expression to modify the order of evaluation.

For more information, click here gif

Now try this question gif


next up previous contents
Next: Control Flow Up: Expressions and Assignment Previous: Operator Precedence

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 18:56:08 GMT 1996
Not for commercial use.