52.9.3 While Loops

While loops are used to repeat a sequence of activities a predetermined number of times.

Suppose we want to execute an FTP download five times over.

Begin by dragging "While" activity to the start of the workflow. (Just as with sequences – compare section "Sequences" –, you first add the empty While construct to the workflow, then fill it with the desired contents.)

In the Properties pane, set the number of times you want to iterate the while loop. Below, by entering the value 5, we stipulate that the loop should be run five times in total.

Now drag the predefined FTP download snippet into the while loop, dropping it onto "sequenceActivity1" in the indicated spot ("Drop Activities Here"):

It may be desirable to insert a brief pause after each pass through the while loop. You can accomplish this by appending a "Wait" activity at the end of the FTP snippet:

Set the duration of the wait in the Properties pane:

For example, if you set Duration to 10 s, the script will perform five FTP downloads in succession with a 10 s idle interval between downloads.
See section "While" for full details on the While activity.