Nodes/yiu_comfy_nodes/.internal/compare
ComfyUI Node

.internal/compare

Compare any two values and get a boolean — the loop's gatekeeper

By leizingyiu·Created about a year ago·Updated 3 months ago· 1
.internal/compare
  • a
  • b
  • boolean
comparisona < b

A comparator is one of those plumbing nodes you don't think about until you need a while loop: "keep going while the step index is less than the total." That's precisely what __y_i_u__compare does, and it's the node the pack's hidden loop machinery uses to decide whether to run another iteration.

It's an .internal node, so it's stripped from the node menu by the pack's front-end code. You'll find it inside saved workflows that use the while-loop or the upscale loop - as the small box that takes two values and a comparison and emits the boolean that gates the loop body.

The standout feature is that its two operands are any-type (*), so you can compare integers, floats, strings, even tensors or whatever else you're threading through the graph. Both are optional with a default of 0, meaning you can wire just one side and compare against zero. The comparison dropdown has the full six-pack: <, <=, ==, !=, >, >=, defaulting to a < b.

Inputs

  • a / b - any type, optional (default 0).
  • comparison - a < b, a <= b, a == b, a != b, a > b, or a >= b.

Output

boolean - a BOOLEAN result. Wire it into a loop's condition input (like __y_i_u__while_loop_end) and you've got a classic "iterate while the counter is under the limit" loop.

Installing it

Part of yiu_comfy_nodes by leizingyiu:

cd ComfyUI/custom_nodes
git clone https://github.com/leizingyiu/yiu_comfy_nodes

restart ComfyUI. No extra dependencies.

Where people get burned

  • Hidden from the menu. You can't add it by right-clicking. If a shared workflow contains one, it loads fine on its own - nothing to install beyond the pack itself.
  • Any-type has a cost. Because the operands are *, ComfyUI won't type-check your wiring; compare a string against a number with < and you'll get a Python TypeError at runtime, not a helpful ComfyUI error. Keep both sides the same type.
  • Optional defaults. Leaving b unwired compares against 0, which is handy for "is this index > 0" but confusing if you expected an error. If it's not gating the way you think, check both wires are actually connected.
Category_yiu_nodes/internal

Inputs (3)

NameTypeDefaultDescription
aopt*0
bopt*0
comparisonoptCOMBOa < b6 options: a < b, a <= b, a == b, a != b, a > b, a >= b

Outputs (1)

NameTypeDescription
booleanBOOLEAN