Logic Operation
==, !=, >, <, on any two values, as a BOOLEAN
- a
- b
- BOOLEAN
The comparison node in JNComfy's (jn-jairo/jn_comfyui) small logic cluster: hand it two values and an operator, get a straight BOOLEAN back. Where JN_MathOperation does arithmetic and JN_BooleanOperation does AND/OR/XOR, this one does the "is A bigger than B" side of things - equals, not-equals, greater/less-than, with the >= and <= variants too.
Why you'd want it
Comparisons are the backbone of any conditional logic in a graph - feeding a branch decision, gating whether JN_StopIf halts the run, deciding which side of a JN_Condition ternary gets picked. ComfyUI has no built-in comparison node, so anyone doing anything more than a straight pipeline reaches for a utility pack. rgthree-comfy's Power Puter covers this with a general expression language; JN_LogicOperation is the narrower, no-syntax version - pick an operator from a dropdown instead of writing a > b as text.
How it works
a is required, b is optional (though for every operation this node offers, you'll actually need it - there's no unary comparison in the set). Pick the operator from a == b, a != b, a > b, a >= b, a < b, a <= b. Both operands are typed *, the generic wildcard this pack enables via its own patch to ComfyUI's core input system, so you can compare numbers, strings, or whatever else Python is willing to compare with those operators - it'll error the same way plain Python would if the two types genuinely can't be compared.
The inputs and outputs that matter
a(any type) - required, the left-hand value.operation- pick your comparator:==,!=,>,>=,<,<=.b(any type, optional) - the right-hand value. Every listed operation is binary, so leave this disconnected and you'll get an error, not a sensible default.
Output is a strict BOOLEAN - unlike JN_BooleanOperation and JN_MathOperation, which both output the generic * type, this one commits to BOOLEAN. That makes it a clean, type-safe fit for anything downstream that specifically expects a boolean, like JN_StopIf's condition or JN_Condition's condition.
How to install it
Via ComfyUI Manager: search "JNComfy", install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/jn-jairo/jn_comfyui
then restart ComfyUI. Small, single-author pack, no real community footprint we could find anywhere - no reddit chatter, no knowledge-base entry - so lean on the source if something here doesn't match what you'd expect.
Common issues & troubleshooting
Comparing incompatible types throws an error. Since a/b are the generic * type, this node won't stop you from wiring in, say, a string against a number - if that fails, it's Python's own comparison rules erroring, not a bug in the node. Check what's actually flowing on both wires (JN_TensorInfo or JN_DumpOutput will tell you) before assuming the node is broken.
You need a computed boolean combined with another boolean. This node only compares - for combining two booleans (AND/OR/XOR), that's JN_BooleanOperation, not this one.
Downstream node wants BOOLEAN but you got a type mismatch anyway. That shouldn't happen here specifically - this is the one node in the trio with a strict BOOLEAN output rather than * - so if you're seeing a type error on the output side, double check you're actually looking at JN_LogicOperation and not JN_BooleanOperation or JN_MathOperation, which both output the generic wildcard type instead.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | * | — | |
| operation | COMBO | 6 options: a == b, a != b, a > b, a >= b, a < b, a <= b | |
| bopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |