Boyo For Loop End
Where loop values come home
- flow
- initial_value1
- initial_value2
- initial_value3
- initial_value4
- initial_value5
- initial_value6
- initial_value7
- initial_value8
- initial_value9
- value1
- value2
- value3
- value4
- value5
- value6
- value7
- value8
- value9
Every for loop has two ends, and this is the second one. Boyo For Loop End is the closing bracket of the Boyo For Loop Start/End pair: it receives the loop's flow signal and the pass-through values, and after the loop body runs it hands back the current state of everything - iteration count implicitly advanced, accumulated values intact. On its own it does nothing; paired with its Start node it's what makes looping in ComfyUI actually work.
If you've read the Start article you know the pattern: Start (with total and loop_id) at the top, End at the bottom, everything between runs once per iteration, and values that need to survive thread through both as pass-through slots. This node is where those values come out after the last iteration, so it's also what you read results from when the loop finishes.
How it works
The two required inputs mirror the Start: flow (FLOW_CONTROL - connect this to the Start's flow output; this is the cable that makes them one loop) and loop_id (must match the Start's ID, or the pair won't be recognized as the same loop). The optional initial_value1–initial_value9 inputs and the value1–value9 outputs are the pass-through slots - the values arrive here after each iteration and go back around to the Start for the next one.
It also has its own reset_signal input, same idea as the Start's: when the signal value changes, the loop's internal tagged cache is cleared. That cache is the mechanism the whole pair relies on - the source builds a boyo_loop_<loop_id> key in a module-level cache to persist values across iterations, and the reset signal is how you bust stale cache when a loop needs to restart cleanly.
The wiring that matters
BoyoForLoopStart (total=3, loop_id=1) ──flow──▶ [loop body] ──▶ BoyoForLoopEnd (loop_id=1)
value1 ────────────────────────────────────────────────▶ initial_value1 (loops back)
value2 ────────────────────────────────────────────────▶ initial_value2 (loops back)
value1, value2 → read final results here
The values only persist if you close the loop - the End's valueN outputs must be fed back into the Start's initial_valueN inputs. Wire that circle once and any value in it carries state across iterations; forget the circle and the loop body runs, but nothing accumulates and you'll wonder why the "counter" never counts.
Installation
Part of Boyonodes, no extra dependencies:
cd ComfyUI/custom_nodes && git clone https://github.com/DragonDiffusionbyBoyo/Boyonodes
restart, find it under Boyo/Logic/For Loop.
The honest notes
The pair is a straight port of EasyUse's loop logic, so if you already know EasyUse loops, you know this - the loop_id matching, the pass-through values, the reset signal, all identical in spirit. The value here is that you get the pattern without installing EasyUse, which is one less heavy dependency in an ecosystem that already has enough (the dependency-conflict stories are legendary). If your workflow already has EasyUse, there's no real reason to switch; if you're avoiding EasyUse and need loops, this is the pair to use. Just remember the golden rules: matching loop_ids, and close the value circle - everything else is forgiving, but those two aren't.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| flow | FLOW_CONTROL | — | |
| loop_id | INT | 11–999 | — |
| reset_signalopt | INT | 0 | — |
| initial_value1opt | * | — | |
| initial_value2opt | * | — | |
| initial_value3opt | * | — | |
| initial_value4opt | * | — | |
| initial_value5opt | * | — | |
| initial_value6opt | * | — | |
| initial_value7opt | * | — | |
| initial_value8opt | * | — | |
| initial_value9opt | * | — |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| value1 | * | — |
| value2 | * | — |
| value3 | * | — |
| value4 | * | — |
| value5 | * | — |
| value6 | * | — |
| value7 | * | — |
| value8 | * | — |
| value9 | * | — |