Do-while loop

Description

Allows you to create an algorithm that is repeated multiple times.

Do-while loop contains the If...then and Assign value to variable blocks. If...then block checks if the condition is true. If it's true, the body of the loop is executed. Assign value to variable lets you modify the variable that is used in the condition.

The workflow above sets the counter to 1, then repeats the body of the loop 9 times, until counter will reach 10 (which is not less than 10, therefore condition is false). Console log activity writes the value of the counter variable to the console. After we run the workflow we will see following in the console:

In other words, this activity lets you do blocks inside while the condition is true. As soon as condition becomes false, the 'No' branch is executed.

Parameters

Condition

Contains a boolean expression such as counter < 10. If the condition is met the 'Yes' branch is executed.

Comment

Contains an annotation to the activity. The input text will be displayed above the activity name.

Usage Examples

Useful in processing multiple files. You can create a single algorithm to recognize and process a file and then repeat it several times using the Do-while loop:

  1. Get the list of all files in the folder.

  2. Save this list to a variable.

  3. Create 'index' variable. It will store the current step number (starting with 0).

  4. The body of Do-while loop. It contains:

    1. if..then to check if the index is less than number of files.

    2. Some useful activity that processes a file.

    3. Activity that increments index by 1.

The body of Do-while loop repeats as many times as it takes to process all files in the folder.

This is the way to proccess all the files in the folder regardless of number of files.