Skip to content

While Loop Close (Deprecated)

Terminates or continues a while-style loop region that starts at While Loop Open. If the condition is false, it outputs the current/initial values and ends the loop. If the condition is true, it dynamically re-invokes the nodes contained between the matching Open and this Close to perform another iteration, passing along the current values.
Preview

Usage

Use this node together with While Loop Open to create a while-style loop around a section of your workflow. Connect the FLOW_CONTROL output from While Loop Open to the flow_control input on this node. Provide a boolean condition that determines whether the loop should continue. Feed any loop-carried values through the initial_value inputs and connect the returned outputs to the corresponding inputs inside your looped region for state to persist across iterations. Because this node is deprecated, prefer the newer Loop Open/Loop Close nodes for new workflows.

Inputs

FieldRequiredTypeDescriptionExample
flow_controlTrueFLOW_CONTROLThe loop linkage from the corresponding While Loop Open node. This establishes the loop boundary and internal region to repeat.
conditionTrueBOOLEANControls loop continuation. True triggers another iteration; False finalizes the loop and returns the accumulated values.True
initial_value0False*Loop-carried value slot 0. Provide the current value to carry into the next iteration. Returned as value0.3
initial_value1False*Loop-carried value slot 1. Provide the current value to carry into the next iteration. Returned as value1.current_state
initial_value2False*Loop-carried value slot 2. Provide the current value to carry into the next iteration. Returned as value2.0.75
initial_value3False*Loop-carried value slot 3. Provide the current value to carry into the next iteration. Returned as value3.{'progress': 5}
initial_value4False*Loop-carried value slot 4. Provide the current value to carry into the next iteration. Returned as value4.[1, 2, 3]

Outputs

FieldTypeDescriptionExample
value0*Final or iterated value corresponding to initial_value0.2
value1*Final or iterated value corresponding to initial_value1.updated_state
value2*Final or iterated value corresponding to initial_value2.0.5
value3*Final or iterated value corresponding to initial_value3.{'progress': 10}
value4*Final or iterated value corresponding to initial_value4.[1, 2, 3, 4]

Important Notes

  • Deprecated: Prefer using Loop Open and Loop Close for new workflows.
  • Pairing required: Must be paired with a matching While Loop Open via the flow_control connection; otherwise it cannot determine the loop body.
  • Condition-driven: The loop continues only when condition is True; when False, the node outputs the provided initial_value inputs as final results.
  • Dynamic expansion: Internally clones and re-executes the nodes between the Open and Close on each iteration. The loop-carried values are forwarded via the initial_value inputs.
  • Hidden inputs are system-managed: dynprompt and unique_id are automatically provided; do not connect these manually.
  • Fixed value slots: Provides five generic value slots (0-4). Map your loop state consistently across iterations.
  • Error handling: On internal errors, it returns the current initial_value inputs (i.e., it finalizes with pass-through values).

Troubleshooting

  • Loop never runs: Ensure the condition evaluates to True at least once. If it is always False, the node immediately returns the initial_value inputs.
  • No updates across iterations: Make sure the outputs from nodes inside the loop are routed back into the corresponding initial_value inputs so state is carried forward.
  • Mismatched Open/Close: Verify flow_control comes from the intended While Loop Open and that the loop body nodes reside between the linked Open and Close.
  • Unexpected early termination: Check the condition wiring and values produced inside the loop. If the condition becomes False, the loop ends and returns the current values.
  • Graph expansion errors: Complex or invalid connections inside the looped region can prevent expansion. Simplify the loop body and avoid references to nodes outside the Open/Close region unless intended.