Compare Block
Perform comparison operations between two input values
Overview
The Compare Block allows you to perform comparison operations between two input values. It supports various comparison functions including equality, inequality, less than, greater than, and logical operations such as AND, OR, XOR, NAND, NOR, and XNOR.
Inputs
The first value for comparison. Required.
The second value for comparison. Required.
The comparison function to use. Only available when “Use Comparison Function Input” is enabled in settings.
Outputs
The result of the comparison operation.
Editor Settings
The comparison function to be used for the operation. Available options are:
==
: Equal to!=
: Not equal to<
: Less than>
: Greater than<=
: Less than or equal to>=
: Greater than or equal toand
: Logical ANDor
: Logical ORxor
: Logical XORnand
: Logical NANDnor
: Logical NORxnor
: Logical XNOR
When enabled, adds a “Comparison Function” input port that can override the comparison function setting.
Example: Compare two numbers
- Create a Compare Block and set the
Comparison Function
to>
. - Create two Number Blocks, one with the value
5
and the other with the value3
. - Connect the Number Blocks to the
A
andB
inputs of the Compare Block respectively. - Run the flow. The output of the Compare Block will be
true
, because 5 is greater than 3.
Error Handling
If input A is not provided:
- For
==
comparison: Returnstrue
if B is also not provided,false
otherwise - For
!=
comparison: Returnstrue
if B is provided,false
otherwise - For all other comparisons: Returns
false
If the inputs are not of the same type, the block will attempt to coerce the second input (B
) to the type of the first input (A
).