Loop task
The Loop task contains a sequence of tasks that may be performed multiple times.

One detail to notice in the figure is that the Loop task includes more than its palette shape. Its flow ends with an arrow that returns to the top.
The purpose of the sample workflow shown in the figure is to find slots in a warehouse to put a new batch of products. The workflow begins by creating a temporary record that it will use to keep track of which slots remain to be checked. It retrieves the slots that may have sufficient storage space available. It then associates the slots with the temporary record. The next task is the loop task.
All that the Loop task does is perform the sequence of tasks it contains over and over. The first task in its sequence retrieves one of the slots associated with the temporary record.
The next task is a Break task. A Break task works with the Loop task that contains it. What a Break task does is decide if the next task to be performed should be the next task inside the loop or the task after the loop.
The Break task in the figure checks if there was a next slot for the preceding task to retrieve. If there was a slot to retrieve, the next task in the loop is the next task that will be performed. However, if there was no next slot, then the Break task breaks out of the loop, making the next task to be performed the end task after the loop.
Break tasks are described in Break task.
If the loop continues after the Break task, it adds as much of the product batch as still remains and will fit to the slot. It then reduces the amount of product remaining to be stored. Finally, it removes the association between the slot it just checked and the temporary record.
After it finishes this, the Loop task has finished performing its sequence of tasks. The Loop task continues by executing its sequence of tasks again, beginning with the task labeled Retrieve Next.
The Loop task maintains a count of the current loop it is in. The loop count is exposed as the Result Count. The Loop task can be named so you can identify it in other tasks. The loop Result Count can be used in conditions, for example, in a Break task or Switch task condition.
The Loop task has a delay value. When the delay value is greater than 10, the loop will delay that many milliseconds before executing the next iteration.
Often, it is possible to arrange for a sequence of tasks to be performed on multiple records at once. When you can find such a sequence of tasks, it is always a better way to do things that way than using a loop. Loops are harder to configure, easier to get wrong, and slower to run. Avoid using loops when possible.
Iterator is simpler than loop
The Loop task is very flexible and can be used to create a great variety of loops. One of the most common kinds of loops is a loop where each time through the loop, the body of the loop works on a different record in a list of records.
Because this is a particularly common case, the platform has another workflow task named Iterator that makes it simpler to write this common type of loop. Use the Iterator task instead of the Loop task. For more information, see Iterator task