Loop

The Loop building block is used to create explicit loops, triggering something to happen a specific number of times, counting from a minimum to a maximum value. For instance, a loop can trigger something to happen 10 times, counting from 1 to 10.

Fully expanded, the Loop block shows the following properties:

Loop

The Block Header (“Loop”)

The green input connector in the header is used to trigger the block to start executing, initializing the loop.

The green output connector in the header triggers on each iteration in the loop.

The title of the block (“Loop”) can be changed by double-clicking on it and typing in a new title.

Minimum

The inclusive value to count from. For instance, in a loop from 1 to 10, the minimum value would be 1.

Maximum

The inclusive value to count to. For instance, in a loop from 1 to 10, the maximum value would be 10.

Current value

The current value in the iteration. For instance, in a loop from 1 to 10 using a step value of 1, on the third iteration the current value would be 3.

When the loop is completed, the current value will be the maximum value. In a loop from 1 to 10, that would mean 10.

Completed

Triggers when the loop is completed after reaching the maximum value — or in cases where the maximum value isn’t divisible by the step value, as close as possible without exceeding it.

Step

The amount the current value should be incremented on each iteration.

In a loop from 1 to 10 with a step value of 1, the loop would trigger 10 times (1, 2, 3, 4, 5, 6, 7, 8, 9, 10). If the step value was 4, the loop would only trigger 3 times (1, 5, 9).

 

Updated February 2nd 2017.