IF A Else B
The lazy A/B switch that only runs the branch you pick
- on_true
- on_false
- output
IF A Else B is the ComfyUI version of a ternary operator: a boolean in, one of two inputs out. You wire your two candidate values into on_true and on_false, feed a boolean into the third socket, and output hands you whichever branch the boolean picked. It lives under Eclipse β Router, and it's the shape the KB's node-plumbing doc calls an A/B switch - a manual routing valve for keeping two paths in one workflow and flipping between them without re-wiring.
The twist that makes this one worth using instead of the dozens of other switch nodes is laziness. The on_true input is declared lazy, meaning ComfyUI won't execute whatever's upstream of the branch you didn't choose. That's a real difference from a dumb any-switch: you can hang a heavy model load or a whole sampler chain off on_true, leave the expensive branch turned off, and the workflow doesn't pay for it. In the plumbing doc's terms, this is where the graph becomes a small program - conditionals with actual short-circuiting instead of just wire-swapping.
What to actually set
- boolean - the condition.
Trueβon_true,Falseβon_false. Keep it simple; this is your toggle. - on_true - any value (the input is a MatchType/any socket, so models, latents, strings, images all work).
- on_false - optional. Leave it unconnected and it returns
None, which is the entire basis of "if this branch is dead, emit nothing" workflows. A downstream optional input readingNonejust treats the branch as absent. - Purge_VRAM - if you're flipping between two big model loaders, turn this on and it clears VRAM before switching so the incoming model has room. Costs a reload on every flip, so it's a "switching models, not samples" option.
One subtlety: if boolean arrives as something that isn't a real True/False (some nodes output truthy junk), the node coerces it - non-None counts as true. So an empty-but-connected value can surprise you. Feed it a proper Boolean node (Eclipse has one) and you'll never hit that.
Where you'd actually use it
The classic build: two checkpoints or two denoise strategies in one workflow, and a single boolean toggle (or a value driven by a mode-switch node) picks the path. Want "quick preview vs. full quality" in one graph? Put the fast sampler chain on on_true, the slow one on on_false, toggle, done. The lazy execution means the unused path isn't just bypassed - it doesn't run at all.
Installing
It's part of ComfyUI_Eclipse, the all-in-one utility pack from r-vage. Install via ComfyUI Manager (search ComfyUI_Eclipse) or:
cd ComfyUI/custom_nodes
git clone https://github.com/r-vage/ComfyUI_Eclipse
Restart ComfyUI; the node is under Eclipse β Router. Standard deps (torch, numpy, Pillow, opencv-python) plus whatever the pack needs; on a clean environment run pip install -r requirements.txt. Note this pack is built for current ComfyUI (frontend 1.51.2+ for the fancy widgetry) and its v4.0 rewrite killed off legacy RvTools_v2 nodes - there's a built-in Workflow Migration Tool if old workflows break on load.
Where people get burned: forgetting Purge_VRAM defaults to off and wondering why a big model swap OOMs, and treating on_false as mandatory when the real power is leaving it empty and letting None flow. Try the lazy branch thing first - it's the reason this node exists.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| on_true | COMFY_MATCHTYPE_V3 | Value to return if boolean is True. | |
| boolean | BOOLEAN | false | Condition to select on_true or on_false. |
| Purge_VRAM | BOOLEAN | false | If True, purges VRAM before switching. |
| on_falseopt | COMFY_MATCHTYPE_V3 | Value to return if boolean is False. Unconnected returns None. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | COMFY_MATCHTYPE_V3 | The output value. |