Precedence of Operators - AFS

AFS Integration Guide

Reference Guide

Complex expressions or predicates can raise concerns about the evaluation order of their operands.

For example the following expression:

a = b and c or d

could theoretically either be analyzed as:

a = (b and c) or d

or as:

a = b and (c or d)

All operators have a priority, defining the evaluation order. When several operators are involved, the one with the highest priority is evaluated first. When several operators have the same priority, the expression is evaluated from left to right.

For more information about the priorities of predicate and expression operators available for AFS v7.9, see Precedence of Items.

In the previous example, the expression is analyzed as:

a = (b and c) or d

Precedence levels for operators can be manipulated or become more legible by removing possible ambiguities using parentheses signs ( and ), as in:

a = (b and c) or d

There is no impact on performance when using explicit parentheses signs. It is usually a good idea to use them to improve the readability of the expressions and predicates.