Compare Int
Gating workflows on a number
- BOOLEAN
Integers are the coins of ComfyUI - seeds, step counts, batch sizes, widths, heights - and SL_CompareInt is the node that turns a relationship between two of them into a boolean you can act on. Pick an operator from the dropdown (==, !=, >, <, >=, <=), wire in two integers, and out comes True or False. That boolean is what conditional branches are built from.
This is the workhorse of "should I do the thing" decisions that hinge on discrete values: "if steps exceed 30, run the second pass," "if the seed is even, use the other prompt," "if batch index passed N, stop." It's the integer twin of SL_CompareFloat, and for integers it's actually the safer of the two - no floating-point precision traps, because whole numbers compare exactly. == on integers means exactly what you think it means.
The mechanism is a dictionary lookup mapping the operator to a Python comparison. Nothing hidden: >= is >=, the result is a plain boolean.
Inputs:
a(INT) - first value, default 0b(INT) - second value, default 0op- dropdown with the six comparison operators- Output:
BOOLEAN- the comparison result
The operator is chosen once on the node's config panel, not via a wire. You get one clean comparison per node; for multiple conditions you chain them through logic nodes like SL_AND.
Installing it
Part of ComfyUI-SimpleLogics. Manager → search "SimpleLogics" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/danipisca07/ComfyUI-SimpleLogics
Restart, Add Node → search "Compare Int" (menu group SimpleLogics/Compare). Zero dependencies, no downloads.
Where it shows up
- Seed and step gating: branch on whether a seed or step count crossed a line - the classic "only do the second upscale when steps > 30" pattern.
- Loop/counter guards: in batch or iteration workflows, compare an index against a bound and stop or switch when it's reached.
- Feeding switch nodes: the boolean output drives
SL_SwitchInt,SL_SwitchString, orSL_SwitchAnyto pick which branch's value flows onward.
Gotchas
- INT is a strict input. If you're coming from a FLOAT source, you'll hit a red link - run it through
SL_FloatToInt(orSL_NumberToInt) first. Note the reverse is friendly: this node can't take floats, butSL_CompareFloathappily accepts INT wires if your values are already whole. - Two fixed inputs, one operator. For a range check like "5 < x < 20," you need two Compare nodes ANDed together. This one does a single relationship per node.
- Defaults of 0: an unwired
aorbsilently compares against 0.
There's no magic here, and that's the point. When you want a workflow that actually decides things based on its own numbers, Compare Int is the hinge everything else swings on.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 0 | — |
| b | INT | 0 | — |
| op | COMBO | 6 options: ==, !=, >, <, >=, <= |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |