π If condition
The node that lets one value take two paths
- Value
- Flow
- True
- False
The "π If condition" node is FlowNodes' take on the most basic programming construct there is: if this is true, do one thing; otherwise, do another. You feed it a boolean and a value, and it routes the value to one of two outputs. It's the node you reach for when a workflow needs to branch - upscale or don't, use this prompt or that one, save or skip.
The mechanism is dead simple. You have three inputs: Bool (the BOOLEAN condition), Value (any type, *), and an optional Flow. The node has two outputs, True and False, both *. If Bool is true, the value comes out the True socket; if false, it comes out False. The key detail is what happens to the other output: it gets None.
The gotcha that defines this node
The README is blunt about it: "This node should be connected on the location of an optional input, as otherwise, returning None will cause errors."
Here's the thing - when the branch is inactive, that output is literally None, and ComfyUI will not let you feed None into a required input. A None into a required socket is a runtime error, or worse, a silent failure. So this node is built for the case where the inactive branch can be safely ignored: an optional input that reads None as "not connected," a fallback switch that skips empty values, or a node that tolerates it.
That's also the big difference between this node and the π Boolean Switch expression. The switch always outputs a real value (whichever branch the boolean picked). If-condition always outputs one real value and one None. Same routing instinct, opposite failure profiles:
- If condition - for branching where the inactive side is genuinely "nothing happens."
- Boolean Switch expression - for choosing between two things that both exist.
Pick based on whether your "false" case has an actual value or is genuinely empty.
Wiring it in
The canonical ComfyUI use: conditionally upscale. Compute a boolean (say, an image-size Compare), route the latent into Value, and let the True output feed the upscale branch while False goes straight to the sampler. Because the inactive output is None, the branch that's "off" simply doesn't have a value to run - that's the point.
The optional Flow input lets you anchor the branch decision to a point in a flow sequence if you're mixing in FlowNodes' ordering system.
Install
Part of the FlowNodes pack:
cd ComfyUI/custom_nodes
git clone https://github.com/gitmylo/FlowNodes
# restart ComfyUI
or ComfyUI Manager β search FlowNodes β install. No Python dependencies, no models.
Troubleshooting
- "None" errors or a dead branch - you fed the inactive output into a required input. Reroute so the inactive side lands on an optional socket, or use the Boolean Switch instead.
- Both outputs seem active - check
Bool. An unwiredBOOLEANdefaults toFalse, so the "False" path is the one actually live. - Value comes out unchanged - correct. The node never transforms the value; it only decides which exit it takes.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| Bool | BOOLEAN | β | |
| Value | * | β | |
| Flowopt | FLOW | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| True | * | β |
| False | * | β |