Skip to content

For Loop Open (Deprecated)

Opens a legacy for-style loop. It initializes a loop counter and passes through up to four auxiliary values to be carried across iterations. Internally it sets up a while-loop gate using the counter as the condition and must be paired with For Loop Close.
Preview

Usage

Use this node at the start of a deprecated for-loop sequence together with For Loop Close. Set 'remaining' to the number of iterations you want. Connect the 'flow_control' output to For Loop Close, and wire any state you want to preserve between iterations via value outputs to the corresponding 'initial_value' inputs on the close node. Prefer the newer Loop Open/Loop Close nodes for new workflows.

Inputs

FieldRequiredTypeDescriptionExample
remainingTrueINTNumber of iterations to perform. Used as the loop condition; iterations proceed while this value remains non-zero. The close node decrements this each cycle.5
initial_value1FalseWILDCARDFirst carried value passed into the loop body and back to the close node each iteration.image tensor or integer accumulator
initial_value2FalseWILDCARDSecond carried value passed through the loop.list, dict, or any data
initial_value3FalseWILDCARDThird carried value passed through the loop.string or model handle
initial_value4FalseWILDCARDFourth carried value passed through the loop.boolean flag

Outputs

FieldTypeDescriptionExample
flow_controlFLOW_CONTROLHandle that identifies and links this loop instance to the matching For Loop Close.FLOW_CONTROL token
remainingINTThe current remaining-iterations counter exposed to downstream nodes.5
value1*Pass-through of initial_value1 for use inside the loop body.integer accumulator
value2*Pass-through of initial_value2 for use inside the loop body.image tensor
value3*Pass-through of initial_value3 for use inside the loop body.dict
value4*Pass-through of initial_value4 for use inside the loop body.boolean

Important Notes

  • Deprecated: Use Loop Open and Loop Close for new workflows.
  • Pairing required: Must be connected to For Loop Close via the flow_control output; otherwise the loop will not iterate.
  • Counter handling: The hidden initial_value0 overrides 'remaining' on entry and is typically fed from the close node to update the counter.
  • Iteration logic: The actual decrement and continuation check are performed in the For Loop Close node; this open node just initializes and forwards values.
  • Type flexibility: value1–value4 accept any data type and are preserved across iterations when properly connected.
  • Range limits: 'remaining' accepts 0–100000. A value of 0 means the loop will not execute.
  • Error behavior: On internal errors, the node returns default outputs and no expansion of the loop graph.

Troubleshooting

  • Loop doesn't start: Ensure 'remaining' > 0. A zero value prevents any iteration.
  • No iteration occurs: Verify the flow_control output from For Loop Open is connected to For Loop Close and that the close node is configured to decrement and feed back the counter.
  • State not preserved: Connect value outputs from this node to the corresponding 'initial_value' inputs on For Loop Close; mismatched or missing connections break state carry-over.
  • Close node errors or missing nodes: For Loop Close relies on integer math and condition nodes; ensure the required nodes are available in your environment.
  • Unexpected remaining value: The hidden initial_value0 overrides the visible 'remaining'. Check the connection from the close node feeding this hidden input.