For loop

Flow control
For loop
Loop body
First index 0
Completed
Last index 10
Index

Description

Iterates from firstIndex to lastIndex (inclusive), firing the loop-body pin with the current index, then completed when done.

When to use

Use For loop when you need to repeat a block of nodes a known number of times and want the current iteration number available as the index output. It is simpler than For each when there is no array to iterate — just set firstIndex and lastIndex. For iterating over an existing array, use For each. The completed pin fires once after all iterations, allowing a clean-up or summary step.

Pins

Input pins

Pin Type Default Notes
First index integer 0 The starting index (inclusive). Defaults to 0.
Last index integer 10 The ending index (inclusive). If lastIndex is less than firstIndex the loop body never fires.

Output pins

Pin Type Notes
Index integer The current loop counter on each loop-body iteration, starting at firstIndex.

Execution pins

Pin Direction
In Input
Loop body Output
Completed Output

Example

Log the numbers 1 through 5. Set First index to 1 and Last index to 5. On the Loop body execution output, wire the Index output through Integer to string and feed the Result output into the Message input of Log message. After the fifth iteration the Completed execution output fires and a final summary message is logged.

See also