Reference > Expressions > Constructing Expressions > Operators

Operators

 

Supported Operators

The following categories of operators are supported:

The operators supported in HEAT are:

Category Name Operator
Arithmetic Addition +
Arithmetic Subtraction -
Arithmetic Multiplication *
Arithmetic Division /
Arithmetic Remainder %
Boolean NOT !
Boolean AND &&
Boolean OR ||
Relational Less Than <
Relational Greater Than >
Relational Less Than or Equal <=
Relational Greater Than or Equal >=
Equality Equal ==
Equality Not Equal !=

 

Operator Precedence

The following table illustrates the order of precedence of the operators, from highest to lowest precedence.

Operators in the same row have the same precedence, which are evaluated from left to right, based on the appearance of the operators in the expression.

Category Operators
Boolean NOT !
Multiplicative * / %
Additive + -
Relational / Equality < > <= >= == !=
Boolean AND &&
Boolean OR ||

You can use parentheses to control precedence and associativity. When you save an expression, if you did not specify parentheses, the system automatically adds additional parentheses.

For example, if you enter the following expression:

$(3 + 4 * 5)

When you save it, the system displays the expression as:

$(3 + (4 * 5))

This is consistent with the order of precedence as shown in the previous table.

The Boolean operators (||, &&) support short circuiting:

For the Boolean AND (&&) and Boolean OR (||) operators, while defining the expression, you can opt to specify the operators as AND or OR, respectively. The system automatically converts them to && or || when you save the expression.

For example, if you define the iif() expressions as:

$(iif(

<Expr1> AND <Expr2>,

  …

))

$(iif(

<Expr1> OR <Expr2>,

  …

))

The system saves the respective expressions as:

$(iif(

<Expr1> && <Expr2>,

  …

))

$(iif(

<Expr1> || <Expr2>,

  …

))