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
Section titled “Comparison operators”Comparison operators are useful when working with Logic functions.
- less
<- (a < b) returns true ifais strictly less thanb - less equal
<=- (a <= b) returns true ifais less than or equal tob - greater
>- (a > b) returns true ifais strictly greater thanb - greater equal
>=- (a >= b) returns true ifais greater than or equal tob - not equal
!=- (a != b) returns true ifais not equal tob - equal
==- (a == b) returns true ifais exactly equal tob
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
Section titled “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)
Index operator
Section titled “Index operator”The index operator allows indexing into arrays of data.
- square brackets -
[]- (array[i]) returns theith value within thearrayvariable
It is also possible to index into arrays using negative indexes - array[-1] would select the last item in the array, and array[-2] would select the second from last. Note that the array must contain enough elements to support this, otherwise the expression will result in an error.
Arithmetic operators
Section titled “Arithmetic operators”Arithmetic operators allow the writer to combine numeric values within expressions using common arithmetic operations.
- addition -
+- (a + b) returns the sum ofaandb - subtraction -
-- (a - b) returns the result of subtractingbfroma - multiplication -
*- (a * b) returns the product ofaandb - division -
/- (a / b) returns the quotient ofadivided byb - modulus -
%(a % b) returns the remainder ofadivided byb