Nested Loop

Hello,

how can I place a “loop” element inside of an “alt” element, in a sequence diagram? For example if I want to represent the following code:

try
{
    while (x <= 100)
    {
         //do something
    }
}
catch
{
    //...
}

How should I diagram this?

Dear Christian,

Thank you for your message. The following steps may help you to create a loop inside the alt combined fragment (assume you have 2 lifeline created):

  1. Select Alternative Combined Fragment icon at the diagram toolbar and click on the diagram to create the alt combined fragment

  2. In the Add/Remove Cover Lifeline dialog, select the lifelines that you want to be involved in the combined fragment

  3. Right click to the alt combined fragment and select Manager Operands to define the guard conditions.

  4. Go back to the diagram toolbar, this time hold down the Alternative Combined Fragment icon to open the popup menu. Select Loop Combined Fragment in the popup.

  5. Click on the diagram to create the loop combined fragment and drag it inside the alt combined fragment.

  6. Right click to the loop combined fragment, select Manage Operands and define the loop conditions.

If you have any further questions, please feel free to contact us again.

Best regards,
Rain