Skip to main content

Foreach

Iterate through the elements of an array.

Ossi Galkin avatar
Written by Ossi Galkin
Updated over 3 years ago

Foreach shape takes in an Expression that should be of type IEnumerable, for example a List or an Array []. Each item in the Expression will be be executed in sequence.

The shape also has a Variable parameter which can be used inside the Foreach scope iteration with #var.<variableName>. This is the value of the current item in the iteration.

Another variable that is available inside the scope is #var.<variableName>_index which contains the current iteration index of the Expression input.

The return value of a Foreach scope is a list of the return values for each iteration. The return values are ordered in the same way as the provided list.

Did this answer your question?