If Then Else
If Then Else — the branch in your graph, without a single line of code
- if_true
- if_false
- result
This is the node that turns your workflow from a straight line into a decision tree. It takes a boolean condition and two values - if_true and if_false - and passes one of them through based on the condition. It's the if/else of ComfyUI, expressed as a box, and it's the payoff node of the Utilitools pack's logic trio: AND, OR, and NOT give you ways to build conditions, and this is where they land.
Three required inputs: condition (BOOLEAN, default true), if_true (wildcard *), and if_false (wildcard *). One output, result (wildcard *). If the condition is true you get if_true out; otherwise if_false. That's the whole mechanism - Python's if_true if condition else if_false - and it's about as transparent as a node gets.
How to actually wire it
Because the two branch inputs are wildcards, they can carry any type - a float, a string, a latent, even a full image. So the classic pattern is: build a condition (a manual toggle, or the output of a Boolean AND/OR), connect your "when true" value to if_true and your "when false" value to if_false, and the output becomes whichever applies. A real example: a "high quality" toggle - if_true gets a CFG of 7, if_false gets 4, and the sampler's CFG follows your switch. Or a batch workflow where one branch uses a 512 base and the other a 768 base, and the resolution follows the condition.
The power here is that the values being routed can be heavy objects, not just numbers. Routing between two latents or two model loaders based on a condition is the kind of thing that otherwise requires rebuilding the whole graph.
The gotchas that bite
Wildcard typing is both the feature and the trap. ComfyUI can't verify that if_true and if_false are the same type - if you route a latent on one side and a float on the other, the node won't complain, but whatever downstream is expecting will. Keep both branches the same type or you'll get a confusing runtime error later. Second, both branch inputs are required - there's no "if no false branch, pass nothing" mode, so you always have to supply both. And third, remember the boolean inputs to build conditions come from somewhere: this node only routes based on the condition you give it, so pair it with the pack's Boolean gates or any other boolean source.
Installing it
Standard Utilitools install:
cd ComfyUI/custom_nodes
git clone https://github.com/aesethtics/ComfyUI-Utilitools
or search "Utilitools" in ComfyUI Manager and restart ComfyUI. It's under Utilitools → Logic. No dependencies, no model files - the whole pack is pure Python. It's a small, low-profile pack, but this node is the reason the logic trio is worth having: it's where all those booleans finally do something.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| condition | BOOLEAN | true | — |
| if_true | * | — | |
| if_false | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | * | — |