If else(IfElse)
The If else node is a logic branching node from the ComfyUI-Easy-Use package.
If Else
Description
The If else node is a logic branching node from the ComfyUI-Easy-Use package. It evaluates a Boolean condition and returns one of two arbitrary input values: on_true when the condition is True, or on_false when the condition is False. The node is located under EasyUse/Logic.
Inputs
-
boolean (BOOLEAN, required):
The condition to evaluate. WhenTrue, theon_truevalue is passed through; whenFalse, theon_falsevalue is passed through. -
on_true (ANYTYPE, required):
The value returned whenbooleanisTrue. Because this input acceptsANYTYPE, it can be connected to almost any ComfyUI data type, including numbers, strings, images, latents, models, or custom structures. -
on_false (ANYTYPE, required):
The value returned whenbooleanisFalse. Likeon_true, this input accepts any data type.
Outputs
- ANYTYPE:
The selected input value. The output will beon_trueifbooleanisTrue, otherwise it will beon_false.
Usage Notes
-
This node does not short-circuit. In ComfyUI, both upstream branches connected to
on_trueandon_falsewill be executed before the condition is evaluated, because inputs are resolved before the node runs. Keep this in mind if one branch is expensive or potentially invalid. -
The input and output types are
ANYTYPE, so both branches do not need to have the same type. The output type will simply follow whichever branch is selected. However, downstream nodes that expect a specific type may require consistent branch types depending on the workflow. -
This node is useful for simple conditional routing in a workflow, such as selecting between two alternative parameters, models, or image-processing paths based on a Boolean flag.
Comments
Sign in with GitHub to join the discussion.