Expression operators

Expression operators are mainly arithmetic operators that take numeric values as arguments. There is also one expression operator that takes textual arguments. Results of expression operators are numeric or textual values. They can be reused as arguments in an expression. Logical operators take integer arguments that are interpreted as bit sets. The operation is performed on the bits, and the result is interpreted as an integer value.

The operators are listed in groups. All operators within the same group are evaluated at the same time, when they appear in an expression without parentheses. Operators from earlier groups are evaluated before operators from later groups.

Example of expression evaluation order

$E1 + $E2 * $E3

This expression is evaluated as ($E1+($E2*$E3)). The * is evaluated before the +, because the * is in the second group, while the + is in the third group.

Exponentiation and special division operators

Exponentiation and special division operators take two numeric arguments and produce a numeric result.

e1 ^ e2

Value of e1 to the power e2

e1 ** e2

Value of e1 to the power e2

e1 rem e2

Remainder of division of e1 by e2

e1 mod e2

Modulo of division of e1 by e2

Multiplicative operators

Multiplicative operators take two numeric arguments and produce a numeric result.

e1 * e2

Value of e1 multiplied by e2

e1 / e2

Value of e1 divided by e2

e1 // e2

Integer division of e1 by e2

e1 >> e2

Bitwise right shift of e1 by e2 positions

e1 << e2

Bitwise left shift of e1 by e2 positions

Additive operators

Additive operators take two numeric arguments and produce a numeric result.

e1 + e2

The sum of e1 and e2

e1 - e2

Value of e1 subtracted by e2

e1 /\ e2

Bitwise conjunction (AND) of e1 and e2

e1 \/ e2

Bitwise inclusive disjunction (OR) of e1 and e2

e1 xor e2

Bitwise exclusive disjunction (XOR) of e1 and e2

Single numeral operators

These operators take a single numeric argument and produce a numeric result.

+ e1

The value e1

- e1

The numeric negation of the value e1

\ e1

The logical or bitwise negation (complement) of the value e1

Concatenation operator 

The following operator takes two string arguments and produces a string result.

e1 || e2

Concatenation of string e1 with string e2

Expression operator example

$E.msg = 'Host ' || $E.mc_host || ' went down';
Was this page helpful? Yes No Submitting... Thank you

Comments