Nodes/ComfyUI Easy Use/easy compare
ComfyUI Node Runs on cloud

easy compare

Turn two values into a true/false for branching

By yolain·Created 3 years ago·Updated 8 days ago· 2,633
easy compare
  • a
  • b
  • boolean
comparisona == b

Two values go in, a true/false comes out. easy compare checks whether a equals b, or is greater, or less, or not-equal - and hands you the boolean. It's the node that lets a workflow ask a question and act on the answer, which is the whole basis of any graph that does more than run the same path every time.

It's a Logic/Math utility in ComfyUI-Easy-Use, and it's the natural partner to the pack's easy ifElse, switches and loop nodes. Comparison produces the condition; those nodes consume it.

Why you'd reach for it

Whenever a decision depends on a value rather than a fixed choice. Inside a for-loop, check whether the counter hit a threshold and stop. Compare an image count against a target and branch. Test whether a returned string matches an expected one before continuing. On its own a comparison is just a fact; wired into a branch, it's control flow. If you're building anything that loops or conditionally skips a stage, you'll reach for this constantly.

How it works

It takes two inputs of any type and a comparison operator, evaluates a <op> b, and outputs the boolean result. Because both inputs are the wildcard * type, you can compare numbers, strings, or whatever else two upstream nodes emit - though comparing like with like is the sane path (see below). The operator is a dropdown defaulting to a == b, with the usual set (equal, not-equal, greater, less, and their or-equal variants).

The inputs and output

  • a and b - the two values to compare. Any type; connect them from upstream or leave one as a reference constant.
  • comparison - the operator, default a == b. Pick equality, inequality, or an ordering.

Output: a single boolean. Feed it into easy ifElse, a switch's selector, or easy isMaskEmpty-style logic chains.

Installing it

ComfyUI Manager: search ComfyUI Easy Use, install, restart. Or cd ComfyUI/custom_nodes && git clone https://github.com/yolain/ComfyUI-Easy-Use, install requirements (install.bat / pip install -r requirements.txt), restart. No models, no dependencies.

Where people trip

Two things. First, type mismatches: comparing a number to a string, or a float 2.0 to an int 2, can give you a surprising answer (or an error) depending on how the values arrive - keep both sides the same type, and if you're comparing computed floats, remember floating-point equality is fragile (a value that "should" be 0.3 might be 0.30000001). For thresholds, prefer greater/less over exact-equal. Second, like every logic node, easy compare only produces the condition - it doesn't branch. The fork happens in the ifElse or switch you feed it into. Wire the boolean somewhere that reads it, or it does nothing visible.

CategoryEasyUse/Logic/Math

Inputs (3)

NameTypeDefaultDescription
aopt*
bopt*
comparisonoptCOMBOa == b10 options: a == b, a != b, a < b, a > b, a <= b, a >= b, +4

Outputs (1)

NameTypeDescription
booleanBOOLEAN