UML Activity Diagram Loop
You can model the loop using the UML Loop Node. The Loop node consists of 3 partitions (activity regions) that contain various parts of the loop:
- setup - defines the initial conditions of the loop
- test - defines the condition when the loop can continue. The output value of the activity defined in this partition must be true to continue. If it is false, the flow continues with the next node after the Loop node.
- body - defines the activity that will be executed when the test condition is fulfilled.
The example diagram shows a simple loop that iterates from 1 to 10 and repeats an action called 'Do action'.
Simple Flow and Decision Node
The loop can also be depicted using a simple flow with actions and a decision node.