Skip to main content

Using While Activity

While loop is a control flow activity that allows code to be executed repeatedly based on a given Boolean condition. The while loop can be thought of as a repeating if statement.

Let us understand While activity with an example process. An example takes an array of flower names and displays names with index as output. Note: Using the similar example as used in Using Do While Activity. While loop checks the condition first and then executes the set of activities, whereas do-while loop will execute the set of activities at least once, then the condition is checked.

Come, let's create this process in Process Designer:

Step#1

Launch and create a new process in Process Designer

  • Launch Process Designer from the Windows Start menu located under IntelliBuddies Enterprise

Step#2

Create New Process

  • Click on New Process and fill in the new process details

Step#3

  • Add an array variable to hold a list of flower names.

  • Int32 variables to hold counter to iterate and length of the array.

  • Add Assign activity to assigh length of array to appropriate variable

Step#4

  • Add While condition to loop till the lenght of the array.

  • Add condition using counter variable

  • With the above condition, control is not allowed to execute the activities in the body of the activity.

  • Hence here incremented the counter before entering the While loop.

  • Now executes till the condition is true, excluding the flower name at first index.

Step#5

Step#6

Save the process

  • From the Design tab ribbon, click on Save

Step#7

Run the process

  • From the Design tab ribbon, click on Run

Step#8

Ensure the process executes and displays the flower name and its index in the flower name array.

Download Example (C#)