Operator precedence in expressions

Architect uses operator precedence at runtime to clarify which procedures it processes first when it evaluates an expression. Let’s look at an example of how Architect determines precedence in an expression. If you enter:

3 + 4 * 5

What is the result of that calculation at runtime: 35 or 23?  The answer is 23, because in general, multiplication takes precedence over addition. Therefore, 4 times 5 equals 20. Add that value to 3 to reach 23.

What if, however, you meant for the calculation to result in 35? In this case, use parentheses in your expression to set the precedence, which directs Architect to perform the addition first, and then multiply the sum by 5. This expression is entered as:

(3+4) * 5

To see the precedence order that Architect follows when processing expressions, and determine which operators take precedence over others, click to expand the following section.

Operator Description

[]

.

Collection access

Property access

! ~

Unary plus and minus

Logical NOT and bitwise NOT

^

Power / exponent ( i.e. 2^3 = 8 )

 * / %

Multiplication, division, and modulus

+ −

Addition and subtraction

< <=

> >=

For comparison operators < and ≤ respectively

For comparison operators > and ≥ respectively

== !=

For relational = and ≠ respectively

&

Bitwise AND

|

Bitwise OR (inclusive or)

and

Logical AND

or

Logical OR