What is Loop Node?

A Loop node executes repetitive tasks that depend on previous iteration results until exit conditions are met or the maximum loop count is reached.

Loop vs. Iteration

TypeDependenciesUse Cases
LoopEach iteration depends on previous resultsRecursive operations, optimization problems
IterationIterations execute independentlyBatch processing, parallel data handling

Configuration

ParameterDescriptionExample
Loop Termination ConditionExpression that determines when to exit the loopx < 50, error_rate < 0.01
Maximum Loop CountUpper limit on iterations to prevent infinite loops10, 100, 1000

Usage Example

Goal: Generate random numbers (1-100) until a value below 50 appears.

Steps:

  1. Use node to generate a random number between 1-100.

  2. Use if to evaluate the number:

    • If < 50: Output done and terminate loop.

    • If ≥ 50: Continue loop and generate another random number.

  3. Set the exit criterion to random_number < 50.

  4. Loop ends when a number below 50 appears.

Planned Enhancements

Future releases will include:

  • Loop variables: Store and reference values across iterations for improved state management and conditional logic.

  • break node: Terminate loops from within the execution path, enabling more sophisticated control flow patterns.