Expressions support the following Boolean operators (which return either 0 or 1):
&&, || |
And, Or |
<, > |
Less Than, Greater Than |
<=, >= |
Less Than Equal, Greater Than Equal |
==, != |
Equal (that's two equal signs), Not Equal |
! |
Not |
iif() between() |
Inline if Evaluate if value is between two other values
|
When evaluating Boolean, any non-zero value is considered true. Therefore !5 equals 0. Like the math operators, the Boolean operators can be applied to arrays, so {2,5,0,2} >= {1,6,3,1} will return {1,0,0,1}.
It is recommended when combining Boolean operators to use parentheses liberally. For example:
if ((MyChannel[0] > 3) && (MyOtherChannel[0] < 2))
This will ensure you get the expression you expect and also makes it easier to read.
The inline if, or iif() function is a function, not an operator, but this seems an appropriate place to talk about it. The function takes three parameters. The first is an expression. If the expression evaluates to a non-zero value, the function returns the second parameter. Otherwise it returns the third parameter. So:
iif(5 < 10, "less than", "greater than") will return "greater than" while
iif(15 < 10, "less than", "greater than") will return "less than"
The iif() function shortcuts, which means that it will only evaluate the second or third parameter if it needs to. This makes it so you won't get an error if it can't be evaluated. For example:
iif(isEmpty(x), 5, x)
would generate an error whenever x is empty if iif() didn't shortcut because the system would try and evaluate the third term, x, and generate an error because there is no x. But, since iif() does shortcut, this expression works and will return 5 if x is empty, and x if it is not.
Between() is also a function, not an operator, that returns true if the value in the array is between the lower and upper bounds provided. The function takes three parameters: between(array, lowerBound, upperBound) and really is just a short hand for:
(array >= lowerbound) && (array <= upperbound)
Note: lowerbound should always be < upperbound or you will always get 0 (false). Also, while array can be an array, lower and upperbound must be scalars.