The Logic node allows you to compare two values of Number, Boolean, or String type, or two lists of values of any of those same types. Values being compared of incompatible types will always result in an output of false
. The way in which comparisons work is slightly different for each of the three supported types.
Supported Operations
Booleans
Operation
|
Result
|
Greater than (lhs > rhs)
|
true if only the lhs is true , otherwise false
|
Greater than or equal to (lhs >= rhs)
|
true if the lhs is true , otherwise false
|
Less than (lhs < rhs)
|
true if only the rhs is true , otherwise false
|
Less than or equal to (lhs <= rhs)
|
true if the rhs is true , otherwise false .
|
Equal to (lhs = rhs)
|
true if both lhs and rhs are true or false , false if lhs and rhs are different
|
Not equal to (lhs != rhs)
|
true if lhs and rhs are different, false if both lhs and rhs are equal
|
Or (lhs | rhs)
|
true if either lhs or rhs are true , otherwise false
|
Exclusive or (lhs but not rhs | rhs but not lhs)
|
true if only lhs or rhs is true , false if both lhs and rhs are true or are both false
|
And (lhs & rhs)
|
true if both lhs and rhs are true , otherwise false
|
Numbers
Operation
|
Result
|
Greater than (lhs > rhs)
|
true if lhs is greater than rhs , otherwise false
|
Greater than or equal to (lhs >= rhs)
|
true if lhs is greater than or equal to rhs , otherwise false
|
Less than (lhs < rhs)
|
true if lhs is less than rhs , otherwise false
|
Less than or equal to (lhs <= rhs)
|
true if lhs is less than or equal to rhs , otherwise false
|
Equal to (lhs = rhs)
|
true if lhs is equal to rhs , otherwise false
|
Not equal to (lhs != rhs)
|
true if lhs is not equal to rhs , otherwise false
|
Or (lhs | rhs)
|
rounds the lhs and rhs to the nearest whole number and performs a bitwise or operation
|
Exclusive or (lhs but not rhs | rhs but not lhs)
|
rounds the lhs and rhs to the nearest whole number and performs a bitwise xor operation
|
And (lhs & rhs)
|
rounds the lhs and rhs to the nearest whole number and performs a bitwise and operation
|
Strings
String logic is the most complicated of the three supported types upon which the logic node operates. The normal greater than, less than, equal, and not equal style comparisons are performed by comparing the strings alphabetically, meaning "Saint"
is greater than "Bernard"
, but less than "Waltz"
. The And, Exclusive Or, and Or operations are more complicated and are described in depth below. These three operations are unintuitive, and have no practical purpose, but are implemented here to allow for parity in logic support across all types.
Operation
|
Result
|
Greater than (lhs > rhs)
|
true if lhs comes alphabetically after rhs , otherwise false
|
Greater than or equal to (lhs >= rhs)
|
true if lhs comes alphabetically after rhs or is the same as rhs , otherwise false
|
Less than (lhs < rhs)
|
true if lhs comes alphabetically before rhs , otherwise false
|
Less than or equal to (lhs <= rhs)
|
true if lhs comes alphabetically before rhs or is the same as rhs , otherwise false
|
Equal to (lhs = rhs)
|
true if lhs and rhs are the same, otherwise false
|
Not equal to (lhs != rhs)
|
true if lhs and rhs are not the same, otherwise false
|
Or (lhs | rhs)
|
a new String in which each character from lhs and rhs are converted to a Number, a bitwise or operation are performed on those numbers to produce a new number, and the new number is converted back to a character in the new String result
|
Exclusive or (lhs but not rhs | rhs but not lhs)
|
a new String in which each character from lhs and rhs are converted to a Number, a bitwise xor operation are performed on those numbers to produce a new number, and the new number is converted back to a character in the new String result
|
And (lhs & rhs)
|
a new String in which each character from lhs and rhs are converted to a Number, a bitwise and operation are performed on those numbers to produce a new number, and the new number is converted back to a character in the new String result
|
Nulls
When a Null value is provided to both the lhs
and rhs
of any logic operation, the result will always be true
.
Operation
|
Result
|
Greater than (lhs > rhs)
|
true
|
Greater than or equal to (lhs >= rhs)
|
true
|
Less than (lhs < rhs)
|
true
|
Less than or equal to (lhs <= rhs)
|
true
|
Equal to (lhs = rhs)
|
true
|
Not equal to (lhs != rhs)
|
true
|
Or (lhs | rhs)
|
true
|
Exclusive or (lhs but not rhs | rhs but not lhs)
|
true
|
And (lhs & rhs)
|
true
|
Non-comparable Values
When the lhs
and rhs
can not be compared (for example when the lhs
is a String and the rhs
is a Number), the result will be false
, with the exception of the Not equal to
operation, which will produce true
as its result.
Operation
|
Result
|
Greater than (lhs > rhs)
|
false
|
Greater than or equal to (lhs >= rhs)
|
false
|
Less than (lhs < rhs)
|
false
|
Less than or equal to (lhs <= rhs)
|
false
|
Equal to (lhs = rhs)
|
false
|
Not equal to (lhs != rhs)
|
true
|
Or (lhs | rhs)
|
false
|
Exclusive or (lhs but not rhs | rhs but not lhs)
|
false
|
And (lhs & rhs)
|
false
|
Handling Nulls
While the Supported Operations section covered what happens when both lhs
and rhs
are Null values, a special behavior is in place when only the lhs
or rhs
are Null and the other side is of a supported type. In these situations, a new value is substituted for the Null in order to better facilitate comparisons with what are considered the types equivalents of Null.
|
Replacement for Null
|
Number
|
0
|
Boolean
|
false
|
String
|
""
|
Settings
|
Expected Type
|
Details
|
Default
|
lhs
|
List<Boolean, Number, or String>
|
The left hand side of the logic operation. This list can contain a mix of the supported types. Unsupported types are treated as Null values.
|
|
operation
|
LogicOperation
|
The operation to be performed on the lhs and rhs lists. This value can be changed externally by assigning $.logic.operation = Packages.com.worldstage.waltz.nodes.LogicOperatorNode.LogicOperation.LessThan or similar.
|
Equal to (lhs = rhs)
|
rhs
|
List<Boolean, Number, or String>
|
The right hand side of the logic operation. This list can contain a mix of the supported types. Unsupported types are treated as Null values.
|
|
Parameters
|
Type
|
Details
|
output
|
Any or List<Any>
|
Note: The parameter is read-only. The logical output of the selected operation , applied to the lhs and rhs . This result is a List if either lhs or rhs contained more than one item.
|
Functions
There are no functions exposed by this node.
Example Usage
No examples provided.