Book a Demo

Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Prev Next

Loop Node

A Loop Structured Activity Node is used for defining a loop, and is commonly associated with ‘While’, ‘Repeat’ or ‘For’ loop statements.

Each Loop Node has three partitions:

  • Setup commonly initiates variables to be used in the loop's exit-condition; it is executed once on entry to the loop
  • Test defines the loop exit-condition
  • Body can contain Actions to be executed repeatedly until the Test produces a false value

The results of the final execution of the Test or Body are available after execution of the Loop is complete.

Create a Loop Node

A Loop Node is depicted on an Activity diagram in this way:

A UML Loop Node showing Setup, Test and Body regions.

You define the Loop nodes by dragging Action elements from the Diagram Toolbox page into the 'Setup', 'Test' and 'Body' partitions. The 'Body' partition can contain several Actions, which can be linked and organized into the required structure. The elements are aligned on the top left of the partition, so that resizing the node maintains the organization of the structure within and between the partitions. If you try to shrink the node below the structure size, the node automatically defaults to the 'best fit' size.

An example UML Activity diagram featuring a Loop Node as modeled in Sparx Systems Enterprise Architect.



See also


From the Activity page of the Diagram Toolbox, drag a Structured Activity icon onto the Activity diagram.

A short menu displays.


Select the 'Loop Node' option.

The Loop Node displays on the diagram, with the element 'Properties' dialog (if the dialog does not display, double-click on the element).


Complete as many of the common element Properties fields as required, then close the 'Properties' dialog.


Display the Properties window ('Start > Desktop > Design > Properties') for the Loop Node, and click on the 'Loop' tab. Set these checkboxes as required:

  • 'Must Isolate' - defines concurrency: if selected, no object within the node can be used outside it; the objects are isolated from parallel use
  • 'Tested First' - defines the loop type; select for a For / While loop, deselect for a Repeat Until loop


For each of these fields, click on the Browse. or Add button as appropriate, to display the 'Select Pins' dialog and select an Action Pin:

  • Decider (an Output Pin within the 'Test' partition, the value of which is examined after execution of the Test to determine whether to execute the loop Body)
  • Loop Variable Input
  • Loop Variable
  • Body Output and
  • Result

The 'Select Pins' dialog lists only Input Pins for the 'Loop Variable Input' field and only Output Pins for the other fields.

If the required Action Pin does not already exist, you can click on the Add New button on the dialog to automatically create the Input pin or an Output pin for the node.


In the 'Nodes' panel, click on one of the 'Setup', 'Test' or 'Body' radio buttons to list the Actions and Activities contained in the corresponding partition of the Loop Node.

An element must be completely below the top edge of a partition to be listed for that partition - if it overlaps with the partition above in any way, it is treated as being part of that partition.


Click on the OK button to save the properties of the Loop Node.


Right-click on the Node in the diagram and select the 'Features | Interaction Points' option.

The Features window displays, showing the 'Interaction Points' tab.

Select the checkbox against each Interaction Point.

The Action pins should now be visible in the diagram, attached to the Node.

Manage Structural Elements


  • You can check on the exact location of an existing Action Pin by right-clicking on the pin name in the Loop Node's Properties window and selecting the 'Find in Project Browser' option; the location of the Action Pin in the Browser window is expanded and highlighted

OMG UML Specification:

The OMG UML specification (UML Superstructure Specification, v2.1.1, pp.384-385) states:

"A loop node is a structured activity node that represents a loop with setup, test, and body sections."

"Each section is a well-nested subregion of the activity whose nodes follow any predecessors of the loop and precede any successors of the loop. The test section may precede or follow the body section. The setup section is executed once on entry to the loop, and the test and body sections are executed repeatedly until the test produces a false value. The results of the final execution of the test or body are available after completion of execution of the loop."