If Else ๐
Pick one of two inputs based on a boolean
- then_value
- else_value
- value
IfElse is a ternary in node form: it takes a boolean and two values, and passes through one of them. Condition true โ you get then_value. Condition false โ you get else_value. It's the little logic gate you reach for when part of your graph needs to branch on a yes/no.
It's one of the general-purpose "Common" nodes in ComfyUI-MieNodes, MieMieeeee's utility pack - the stuff that's useful outside the pack's main LoRA-prep focus.
Why you'd use it
ComfyUI graphs are mostly straight pipelines, and the moment you want them to behave differently based on a condition, you need something like this. Some real cases:
- Toggle between two prompt strings from a single boolean switch - one for a "detailed" run, one for a "quick" run - without rewiring.
- Pick between two models, two images, or two settings depending on the state of an upstream toggle.
- Combine it with a comparison or a boolean coming out of another node to make the choice automatic rather than manual.
Because the value inputs are the * wildcard type, it doesn't care what you're switching - strings, images, numbers, latents, whatever. One node, any type.
How it works
condition(BOOLEAN, required) - the switch. True selectsthen_value, false selectselse_value.then_value(optional,*) - returned when the condition is true.else_value(optional,*) - returned when the condition is false.
The single output is value, also *, carrying whichever input won. Both value inputs are optional, so if you only wire one side and the condition lands on the empty side, you'll get nothing (a None) out - which is occasionally what you want, and occasionally the bug you're chasing.
Installing it
Install the pack. ComfyUI Manager โ search ComfyUI-MieNodes (ComfyUI_MieNodes) โ install โ restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
then restart. No model download. Nodes land under the sheep-emoji ๐ MieNodes menu.
Common issues
It's a value selector, not a compute gate - mostly. The safe mental model is "both branches feed into it and it picks one," rather than "the false branch never runs." Don't lean on IfElse to skip an expensive branch of your graph to save time; treat it as choosing between two values that both already exist. If your intent is genuinely to avoid running a heavy path, that's a job for dedicated bypass/switch tooling in the broader ComfyUI ecosystem, not this node.
Feed it a real boolean. The condition wants an actual BOOLEAN. If you're deriving the switch from a number or a string, convert it to a bool upstream first, or the node has nothing sensible to branch on.
An empty output usually means an unconnected side. If the result vanishes on one setting of the switch, check that both then_value and else_value are actually wired - the optional inputs make it easy to leave one dangling and get a None when the condition flips that way.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| condition | BOOLEAN | โ | |
| then_valueopt | * | โ | |
| else_valueopt | * | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | * | โ |