The Logic Solver Calc/Logic block supports the following operators:
Unary Operators
|
Operator Type |
Example |
|---|---|
|
unary minus (change sign) |
-'a' |
|
unary plus |
+'a' |
|
logical not |
!'a' or NOT 'a' |
|
bitwise not |
~'a' |
Binary Operators
|
Operator Type |
Example |
|---|---|
|
logical or |
'a' OR 'b' |
|
logical exclusive or |
'a' XOR 'b' |
|
logical and |
'a' AND 'b' |
|
bitwise or |
'a' | 'b' |
|
bitwise exclusive or |
'a' ^ 'b' |
|
bitwise and |
'a' & 'b' |
|
equals comparison |
'a' = 'b' |
|
not equals comparison |
'a' <> 'b' or 'a' != 'b' or 'a' ~= 'b' |
|
less than comparison |
'a' < 'b' |
|
greater than comparison |
'a' > 'b' |
|
less than or equal to comparison |
'a' <= 'b' |
|
greater than or equal to comparison |
'a' => 'b' |
|
addition |
'a' + 'b' |
|
subtraction |
'a' - 'b' |
|
multiply |
'a' * 'b' |
|
divide |
'a' / 'b' |
|
modulus (remainder) |
'a' MOD 'b' or 'a' % 'b' |
|
power |
'a' ** 'b' |
Conditional Operator
The conditional operator (?) evaluates one of two expressions, depending on the value of a condition. The syntax for using the operator is
condition?[expression1]:[expression2]
For example, the condition out1:=(in1=1)?in2:in3 means if in1 is equal to 1 then out1 is set to the value of in2, if in1 is NOT equal to 1 out1 is set to the value of in3.