Lazy Conditional | akatz-loops
A ten-way if/else that only runs the branch you pick
- value1
- value2
- value3
- value4
- value5
- value6
- value7
- value8
- value9
- value10
- else
- *
LazyConditional | akatz-loops is a chained if/else compressed into one node: up to ten value/condition pairs, and an else for the fallthrough. It walks the conditions in order and returns the first value whose condition is true; if none match, you get the else value. Think of it as LazySwitch grown up from two branches to ten.
Like the pack's LazySwitch, the inputs are lazy - the node only evaluates the value whose branch actually wins, and everything else stays uncomputed. That's the whole point of the "Lazy" family, and it's genuinely useful in loops where you're dispatching an iteration to one of several processing paths: the sampler branches you don't take never run, and a branch that would fail on this iteration's data can't sink the run.
Inputs and outputs
- value1 … value10, each with a matching condition1 … condition10 (all BOOLEAN inputs, forceInput).
- else - the fallback value when every condition is false.
- All the
value*andelsesockets are*(any type). The single output is the winning value.
All inputs are optional in the schema, but the behavior is straightforward: conditions are checked 1 → 10, first true wins, else if none. The conditions are forced inputs (no widget), so you wire them from a boolean source like a compare node.
When you'd use it
The realistic case is a loop body with a handful of mutually exclusive behaviors: "if the frame counter is in range A do the upscaler, in range B do the sharpen, otherwise pass through." Rather than stacking LazySwitches (which evaluates one choice at a time and gets awkward past two branches), one LazyConditional keeps the dispatch in a single visible node. Same lazy benefits, way less canvas.
It's also a tidy drop-in replacement for a nested-if mess when you're porting a workflow from another pack.
Installing it
Same pack, same drill:
cd ComfyUI/custom_nodes
git clone https://github.com/akatz-ai/ComfyUI-Execution-Inversion
# restart ComfyUI
Or ComfyUI Manager, search "Akatz-Loop-Nodes". opencv-python is the only Python dependency; no downloads.
Gotchas
Ordering is first-match-wins, so put the most specific condition first - if condition1 is "counter > 2" and condition2 is "counter > 5", a counter of 7 hits condition1 first and the more specific branch never fires. That's a classic off-by-one trap. And because the chosen value is the only one evaluated, a None upstream of an unselected branch is fine - but the selected branch's upstream must be present, or you get None out and a downstream type error.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| value1opt | * | — | |
| condition1opt | BOOLEAN | — | |
| value2opt | * | — | |
| condition2opt | BOOLEAN | — | |
| value3opt | * | — | |
| condition3opt | BOOLEAN | — | |
| value4opt | * | — | |
| condition4opt | BOOLEAN | — | |
| value5opt | * | — | |
| condition5opt | BOOLEAN | — | |
| value6opt | * | — | |
| condition6opt | BOOLEAN | — | |
| value7opt | * | — | |
| condition7opt | BOOLEAN | — | |
| value8opt | * | — | |
| condition8opt | BOOLEAN | — | |
| value9opt | * | — | |
| condition9opt | BOOLEAN | — | |
| value10opt | * | — | |
| condition10opt | BOOLEAN | — | |
| elseopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |