Skip to content

Operators

Operators allow the expression writer to perform mathematical operations on numbers and variables within an expression.

There are standard expressions used by many programming languages which are available in Designer expressions. This page provides an overview and brief description of the available operators

Comparison operators

Comparison operators are useful when working with Logic functions.

  • less < - (a < b) returns true if a is strictly less than b
  • less equal <= - (a <= b) returns true if a is less than or equal to b
  • greater > - (a > b) returns true if a is strictly greater than b
  • greater equal >= - (a >= b) returns true if a is greater than or equal to b
  • not equal != - (a != b) returns true if a is not equal to b
  • equal == - (a == b) returns true if a is exactly equal to b

Note that for non-integer numeric values (i.e. floating point values) comparisons can be surprising. When comparing floating point values, consider reworking the comparison to be more fuzzy. For example, a == b could be rewritten to be abs(a-b) < 0.01 which ensures that even if there is a tiny difference between the numbers, the comparison does what the expression writer would expect.

Logical operator

The logical not operator is useful when working with Logic functions.

  • not ! - (!a) flip the truth value of the variable or sub-expression following the operator (true->false, and false->true)

Arithmetic operators

Arithmetic operators allow the writer to combine numeric values within expressions using common arithmetic operations.

  • addition - + - (a + b) returns the sum of a and b
  • subtraction - - - (a - b) returns the result of subtracting b from a
  • multiplication - * - (a * b) returns the product of a and b
  • division - / - (a / b) returns the quotient of a divided by b
  • modulus - % (a % b) returns the remainder of a divided by b