For Loop End
Close the loop, get your final result
- flow
- initial_value_1
- initial_value_2
- initial_value_3
- initial_value_4
- initial_value_5
- initial_value_6
- initial_value_7
- initial_value_8
- initial_value_9
- initial_value_10
- initial_value_11
- initial_value_12
- initial_value_13
- initial_value_14
- initial_value_15
- initial_value_16
- initial_value_17
- initial_value_18
- initial_value_19
- value_1
- value_2
- value_3
- value_4
- value_5
- value_6
- value_7
- value_8
- value_9
- value_10
- value_11
- value_12
- value_13
- value_14
- value_15
- value_16
- value_17
- value_18
- value_19
Pix_ForLoopEnd is the other half of the PixNodes loop pair, and honestly the half that people miswire more often. The start node declares the count; the end node is where your processed values come back around for the next iteration - and where the final result comes out when the loop is done. If you wire a loop without understanding the end node, you'll get a loop that runs, produces nothing you can use, and quietly eats your time.
One required input: flow, which must be connected to the flow output of the matching Pix_ForLoopStart. That connection is what tells the end node which loop it belongs to and lets it reconstruct the iteration logic. Then up to 19 optional initial_value_1 through initial_value_19 slots - these are where the processed versions of your carried values come back in. Whatever your loop body did to value_1 from the start node, you feed the result back into initial_value_1 here, and that becomes value_1 on the next iteration. The outputs, value_1 through value_19, are the loop's final values after the last iteration - what you'd wire onward to whatever consumes the loop's result.
Here's the mental model that makes it click. The start node's values are "what we're working with this pass." The end node's inputs are "what we'll work with next pass." The end node's outputs are "what we have after the last pass." So the path is: start value → loop body → end input → (next pass) → ... → after the final pass, the end's outputs are the accumulated result. That's why the "accumulator" pattern works: connect a Pix_CreateEmptyList into the start, append to the list inside the loop body, feed the growing list back into the end, and when the loop finishes, the end's value_1 output is the complete list.
Under the hood it's ComfyUI graph rewriting - the same GraphBuilder machinery as the start node. The end node reads the start's total, builds an increment (Pix_MathInt adding 1), compares it against the total (Pix_Compare, a < b), and closes the loop through a Pix_WhileLoopEnd. In other words, the for-loop is really a while-loop wearing a trench coat, and this end node is where the disguise is assembled. It also explains the v1.1.0 changelog fix for "loop nodes can't transfer data" - this rewriting is exactly where a data-transfer bug would live.
The most common failure: a loop where the start and end values never actually connect. If you feed an image into the start's initial_value_1 but never bring a processed image back into the end's initial_value_1, each pass re-initializes - the loop runs total times and every pass started from scratch. Watch for that; it's the "why is my loop doing nothing cumulative" mystery.
Install: ComfyUI Manager, search PixNodes, restart, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/pixixai/Comfyui-PixNodes
cd Comfyui-PixNodes
pip install -r requirements.txt
then restart. Only openai and Requests - nothing heavy. Read this together with the Pix_ForLoopStart article; the pair is one feature, and most of the loop debugging you'll ever do is figuring out which value should be coming back into this node.
Inputs (20)
| Name | Type | Default | Description |
|---|---|---|---|
| flow | FLOW_CONTROL | — | |
| initial_value_1opt | * | — | |
| initial_value_2opt | * | — | |
| initial_value_3opt | * | — | |
| initial_value_4opt | * | — | |
| initial_value_5opt | * | — | |
| initial_value_6opt | * | — | |
| initial_value_7opt | * | — | |
| initial_value_8opt | * | — | |
| initial_value_9opt | * | — | |
| initial_value_10opt | * | — | |
| initial_value_11opt | * | — | |
| initial_value_12opt | * | — | |
| initial_value_13opt | * | — | |
| initial_value_14opt | * | — | |
| initial_value_15opt | * | — | |
| initial_value_16opt | * | — | |
| initial_value_17opt | * | — | |
| initial_value_18opt | * | — | |
| initial_value_19opt | * | — |
Outputs (19)
| Name | Type | Description |
|---|---|---|
| value_1 | * | — |
| value_2 | * | — |
| value_3 | * | — |
| value_4 | * | — |
| value_5 | * | — |
| value_6 | * | — |
| value_7 | * | — |
| value_8 | * | — |
| value_9 | * | — |
| value_10 | * | — |
| value_11 | * | — |
| value_12 | * | — |
| value_13 | * | — |
| value_14 | * | — |
| value_15 | * | — |
| value_16 | * | — |
| value_17 | * | — |
| value_18 | * | — |
| value_19 | * | — |