ComfyUI Node Runs on cloud

easy ifElse

Pick one of two values from a boolean

By yolain·Created 3 years ago·Updated 8 days ago· 2,633
easy ifElse
  • on_true
  • on_false
  • *
boolean

A branch, in a place that doesn't normally have branches. Feed it a true/false and two values, and it outputs one or the other: on_true when the boolean is true, on_false when it's false. That's the if/else you know from every programming language, expressed as a single node - and it's more useful than it sounds, because a ComfyUI graph is otherwise a fixed pipeline with no natural way to say "do this or that depending on a condition."

Why you'd reach for it

The moment your workflow needs to decide something, you need this. A few real examples:

  • A toggle that swaps between two prompts, two models, or two upscalers depending on a single switch you flip.
  • A flag that routes between "generate fresh" and "use this fixed image" paths.
  • Inside a loop, choosing a value based on where you are - first iteration does one thing, the rest do another.

You wire the condition (often the output of a comparison, or a boolean primitive you toggle by hand) into boolean, and the two candidate values into on_true and on_false. Downstream sees whichever one the condition selected. It pairs naturally with the rest of the EasyUse/Logic set - boolean nodes to produce the condition, easy showAnything to confirm which branch fired.

The pack advertises this as a lazy if/else, and that word carries weight. In a lazy evaluation, only the branch you actually take gets computed - the other side isn't evaluated. So if on_false is an expensive path, and the condition is true, that expensive path doesn't run. That's the difference between a real branch and a "compute both, throw one away" selector.

The inputs and outputs

  • boolean (BOOLEAN) - the condition. True picks on_true; false picks on_false.
  • on_true (any type) - the value passed through when the condition is true.
  • on_false (any type) - the value passed through when it's false.
  • The single output (any type) - whichever of the two the boolean selected. It takes on the type of whatever you fed in.

Both branches accept any type, so you can switch images, latents, models, strings, numbers - anything - as long as both sides are the same kind of thing you intend to use downstream.

Installing it

ComfyUI Manager: search ComfyUI Easy Use, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Use

then install the requirements (install.bat on Windows, else pip install -r ComfyUI-Easy-Use/requirements.txt) and restart.

Common issues

  • Mismatched branch types. If on_true is an IMAGE and on_false is a LATENT, whatever consumes the output can only handle one of them, and you'll get a type error on the run where the "wrong" one is selected. Keep both branches the same type.
  • "It fails in my setup." The pack's changelog notes that easy ifElse (and its sibling easy anythingIndexSwitch) were fixed for certain environments where they'd previously break - so if you're on an older Easy-Use install and this node misbehaves, updating the pack is the first move.
  • Confirm which branch fired. Because the choice is invisible, hang an easy showAnything on the output while you're building to verify the condition is doing what you think. Nine times out of ten a "wrong result" is a condition that's inverted from what you assumed.
CategoryEasyUse/Logic

Inputs (3)

NameTypeDefaultDescription
booleanBOOLEAN
on_true*
on_false*

Outputs (1)

NameTypeDescription
**