If ANY return A else B 🦾
If this is truthy, give me that; otherwise, the other thing
- ANY
- IF_TRUE
- IF_FALSE
- ?
If ANY return A else B is the workflow-level if statement. You give it a condition (ANY), a value for when the condition is true (IF_TRUE), and a value for when it's false (IF_FALSE). It hands back whichever one applies. That's the whole trick, and it's the node you reach for the moment your graph needs to make a decision instead of just plumbing data around.
Unlike a switch, the "condition" here is just truthiness - anything that can be evaluated as true or false works. A boolean from a Compare node is the obvious case, but a string that's non-empty or a number that's non-zero will do the job too. That looseness is deliberate: the node is a faithful port of the ComfyUI-Logic extension's IfExecute, and "ANY" is the point.
How it works
All three inputs are any-typed wildcards. ANY is evaluated for truthiness; if true, the node returns IF_TRUE; otherwise IF_FALSE. The output is also any-typed (labeled ? in the schema), so whatever you put in comes out - an image stays an image, a conditioning stays a conditioning.
The practical payoff is routing without rewiring: keep both branches alive and pick one at queue time. Want a "draft vs. final" workflow? Feed the draft settings and final settings as IF_FALSE/IF_TRUE and toggle the condition. Want to swap which checkpoint processes a region? Same shape.
The inputs that matter
ANY(required, any type) - the condition. Evaluated for truthiness.IF_TRUE(required, any type) - returned whenANYis true.IF_FALSE(required, any type) - returned whenANYis false.
Output: ? (any type) - whichever branch won.
Install
Part of ComfyUI-Beyond_nodes. ComfyUI Manager → search "Beyond_nodes" → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/beyondprompting/ComfyUI-Beyond_nodes
Restart. No extra dependencies.
Common issues
- Both branches run anyway. This node doesn't implement lazy evaluation the way the pack's Boolean Switch does - the unselected input may still execute if the graph requires it. For a true "don't touch this branch" behavior, use a node with lazy inputs (like the pack's BooleanSwitch) or mute/bypass the dead side.
- An empty string is "false." If your condition is a text field,
""counts as false. That's usually what you want, but it surprises people who expected Python-style non-None behavior - actually, no, that is Python behavior. The node just calls truthiness on whatever it gets. - The
?socket looks odd. It's a wildcard output that takes the type of whatever you wired in. Totally normal.
Where this node really earns its keep is combined with Compare: check a dimension, a seed, a setting, then route the whole downstream branch accordingly. It's the core of "smart" workflows that adapt to their own output.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| ANY | * | — | |
| IF_TRUE | * | — | |
| IF_FALSE | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| ? | * | Based on the value of ANY, either IF_TRUE or IF_FALSE will be returned. |