Nodes/ComfyAngel/ComfyAngel_Compare
ComfyUI Node

ComfyAngel_Compare

The if-statement inside a ComfyAngel loop

By ThepExcel·Created 8 months ago·Updated about a month ago· 14
ComfyAngel_Compare
  • a
  • b
  • BOOLEAN
comparisona < b

ComfyAngel_Compare is a plain little thing that deserves a plain explanation: it takes two values and a comparison operator, and outputs a BOOLEAN. That's it. Six operators to pick from - a == b, a != b, a < b, a > b, a <= b, a >= b - one boolean out. It's the closest thing this pack has to an if statement, and its day job is deciding when a loop should stop.

How it's actually used

Every time you run a ComfyAngel loop, this node is running in the background. Loop End builds its continuation logic with it: it computes the next iteration index, asks Compare is next_index < total?, and uses the answer to decide whether to recurse into another pass or hand back the accumulated results. That's the mechanism - a "while" loop built out of a comparison and a graph that re-executes itself, which is exactly the pattern ComfyUI's dynamic-graph execution exists for.

The inputs a and b are ANY type, so you're not limited to integers. The comparison just falls through to Python's operators - a can be two strings, two floats, two ints, even two tensors if you're brave (Python will compare them element-wise and the result won't be a single scalar - don't). In practice 99% of usage is numbers.

Wiring it yourself

It's hidden from the menu (deprecated internal node), so to add one you either load a workflow that already has it or enable "Show deprecated" in the node search. If you do use it directly, it's for custom loop-ish logic: gate a branch on whether a counter hit its limit, feed the boolean into a switch node to pick between two paths, that kind of thing. The boolean output is a real ComfyUI BOOLEAN, so it plugs into any node that takes one.

Installing it

ComfyAngel is the pack, this is one node in it:

cd ComfyUI/custom_nodes
git clone https://github.com/ThepExcel/ComfyAngel.git

Restart ComfyUI after cloning, or install "ComfyAngel" from ComfyUI Manager. Pillow is the only dependency - nothing to download, no models.

The honest take: you'll probably never add Compare to a canvas by hand, and that's fine. It exists to make loops work, and knowing that "the loop terminates because a hidden Compare says index < total" is the kind of understanding that rescues you the day a loop runs forever.

CategoryComfyAngel/Loop/Internal

Inputs (3)

NameTypeDefaultDescription
a*0
b*0
comparisonCOMBOa < b6 options: a == b, a != b, a < b, a > b, a <= b, a >= b

Outputs (1)

NameTypeDescription
BOOLEANBOOLEAN