For-Each Loop

by @pixiebrix

Loop over elements in a list/array, returning the value of the last iteration


How to Use

The For-Each Loop brick contains a flow that will execute each brick inside it once for each item in the array the For-Each Loop brick is given. This array is input into the ‘elements’ field, and the current item the flow is executing for is accessible using the variable named in the ‘elementKey’ field.

Note that the For-Each Loop brick works based on what was in the given array when it started executing, so changes to that array won’t affect the number of loops or the elements provided.


Inputs

Name Required Type Description
body integration The bricks to execute for each element
elements array A list/array of elements to loop over
elementKey string The element key/variable for the body of the loop, without the leading @

Outputs

Name Required Type Description
No outputs for this brick defined.

@pixiebrix/for-each

Version

1.7.16

Created

June 2, 2022

Updated

Oct. 31, 2022