INT Conditional Operation
Pick the Bigger (or Smaller) of Two Integers With One Node
- RETURN VALUE
ComfyUI graphs get surprisingly clever when values can decide things on their own. This node is a small version of that: it compares two integers and returns one of them based on the comparison. The README's example is the best one - it's great for returning the largest or smallest of two numbers, and it turns a graph from "hardcoded value" into "value that adapts."
Why you'd reach for it
Anytime you'd otherwise sit there and pick between two numbers manually. Take a batch size that depends on your GPU: if VRAM is big, use 4, else use 2 - two possible ints, one comparison, and the node hands back the right one. Same for steps, cfg caps, or a max dimension you don't want to exceed. It's the honest, narrow cousin of the fancier switch/condition nodes other packs ship (rgthree's Anything switch family, for instance): those route whole values around, this one just picks between two ints and outputs the winner. For that one job, it's simpler to wire.
How it works
It's a dictionary of six comparisons - Eq, Neq, Gt, Lt, Geq, Leq - applied to int_a and int_b. If the comparison is true, it returns whichever side if_true_return names (a or b); if false, it returns the other one. Here's the neat part: set op to Gt and if_true_return to a, and the node returns a when a > b, otherwise b - that's a max(). Flip if_true_return to b and you get a min(). Two settings, both obvious once you see it.
Inputs and outputs
- int_a / int_b - the two integers to compare.
- op - the comparison:
Eq,Neq,Gt,Lt,Geq,Leq. - if_true_return -
aorb: which input to return when the comparison holds.
Output: RETURN VALUE, an INT.
Installing it
Part of "quadmoon's ComfyUI nodes". ComfyUI Manager: search the pack title or Install via GIT URL with https://github.com/traugdor/ComfyUI-quadMoons-nodes.git. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/traugdor/ComfyUI-quadMoons-nodes.git
Restart ComfyUI. No models or dependencies.
Common issues
The main gotcha is expecting more from it than it does. It compares ints and returns an int - it doesn't route other value types, it doesn't act as a boolean gate to turn parts of a workflow on and off, and Eq/Neq returning one of the inputs is only useful if you actually need that value. If you find yourself wanting "if this, then run that branch," you want a real switch node from another pack, not this one. And watch Geq vs Gt: off-by-one in which side wins when the inputs are equal is exactly the kind of bug that only shows up at batch size 1.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| int_a | INT | — | |
| int_b | INT | — | |
| op | COMBO | 6 options: Eq, Neq, Gt, Lt, Geq, Leq | |
| if_true_return | COMBO | 2 options: a, b |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| RETURN VALUE | INT | — |