Loops
Automation loops do not function in the same manner as traditional programming loops!
If you are accustomed to programming loops, read this section carefully to understand the differences.
Automation loops provide a mechanism for iterating through arrays of data values. A common example is the line items within an order.
Automation loops are unlike programming loops in that there is no variable with a starting value being incremented until an ending value or criteria is met.
Let's walk through a simple loop as an example. We will use this action to emit an array of 3 values consisting of 'first', 'second', and 'third':

Loops are added by clicking on a "plus" icon and choosing the option:


Click the action field and select the action whose output will be looped upon:

Within the loop we'll just convert those three array elements to uppercase with this action:

The input value to uppercase will be the array output from the first action:

When the automation runs, the loop makes 3 iterations and uppercases the output from the first action:

The scope of the loop is the selected action, which the loop investigates at runtime to determine the biggest array emitted. The loop then iterates that many times, once for each element of the largest array. For each iteration of the loop, any mapped array fields are accessed in succession.
A common source of trouble is if other actions having array output are mapped to items within the loop. If those mapped actions emit arrays that are mapped then the automation execution engine also processes them in the same manner when field mappings are substituted. But if the other actions have larger arrays than the loop's selected action, those extra array elements won't be processed. So always remember that the largest array emitted by the loop's selected action is what controls the loop's number of iterations and the subsequent mapping of array elements.
Loops can contain conditional branches and other nested loops as needed:
