Compare
The Compare node performs a logical/mathematical comparison between two input values and outputs the result as a boolean (True or False).
Compare
Description
The Compare node performs a logical/mathematical comparison between two input values and outputs the result as a boolean (True or False). It is part of the EasyUse/Logic/Math category and is useful for adding conditional logic to a workflow.
Inputs
a
- Type:
ANYTYPE - Optional: Yes
The first value to compare. Because this input accepts any type, a can be a number, string, tensor, or other ComfyUI data type.
b
- Type:
ANYTYPE - Optional: Yes
The second value to compare. As with a, any type can be supplied.
comparison
- Type:
COMBO - Optional: Yes
- Default:
"a == b"
The comparison operator to apply. Choose the desired operator from the dropdown menu. The default is equality: a == b.
Outputs
BOOLEAN
- Type:
BOOLEAN
The result of the comparison. The node outputs True when the comparison holds and False otherwise.
Usage Notes
- All inputs are marked optional, so the node can be placed in the graph and connected as needed. Leaving an input unconnected may result in it receiving
None; make sure both values are supplied for meaningful comparisons. - Since
aandbaccept any type, the available comparisons will be evaluated according to ComfyUI's data semantics. For scalar numbers and strings, the ordering comparisons usually behave as expected. - The node is designed for logic and math use cases, such as comparing numeric parameters, checking conditions, and controlling downstream nodes with the resulting boolean.
Comments
Sign in with GitHub to join the discussion.