Skip to main content

Using Break Activity

The Break activity, when used inside a loop, the loop is immediately terminated, and the program control resumes at the next activity following the loop.

In a nested loop, a Break activity only stops the loop it is placed in. Therefore, if a Break is placed in the inner loop, the outer loop continues. However, if the Break is placed in the outer loop, all of the looping stops.

Let us understand Break activity with an example process. Here is an example that takes input as a number and displays its factors. A nested While loop is used and a Break is added to the inner loop once the factor is found and displayed.

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 array variable to hold the input number and counters/index to get the factors

  • Int32 variable to hold counter and also to iterate.

Step#4

In Activity panel search for Input Dialog

Step#5

  • Add nested While loop to iterated numbers to find the factors.

  • Add condition using counter variable to outer While loop

Step#6

  • Add Writeline to display the factors and finally count of factors.

Step#7

  • Add Break in inner While loop.
  • Break condition becomes true when the iterate/counter number divides the input number. This counter value becomes one of the factor of number.

Step#8

Save the process

  • From the Design tab ribbon, click on Save

Step#9

Run the process

  • From the Design tab ribbon, click on Run

Step#10

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

Download Example (C#)