Loops

In this example, a segment of a process diagram is repeated until a control condition is met. To implement this example, two routes originate at the final activity of the repeated segment:

  • One route terminates at the first activity of the repeated segment.

  • The other route terminates at the next activity after the loop.

  • A condition on one of the routes is evaluated to determine whether the segment is repeated.

    The following illustration shows a loop that contains two activities that are routed sequentially.

Loop counters

In some situations, the loop needs to be executed a certain number of times. You can use a counter to keep track of the number of times the loop needs to be executed:

  • The total number of loops to execute can be provided at run time or at design time.

  • The number of loop iterations is stored in a variable (of type int).

  • For each loop, the value of the variable is decremented by using the Set Value service.

  • The value of the variable is used in the control condition to see whether the loop should be executed again.

// Ethnio survey code removed