I was wondering, how can one represent "if cond1 else if cond2" statement on a sequence diagram?
if (condition1) {
// Do something
} else if(condition2)
{
// Do something else if
}
Im not sure if is it with two independent "Opt" clause
If possible create an image representation of a solution.
As in many types of UML diagrams, you can use guards to denote a condition. A guard is a boolean expression that you can write over a transition. Notice the "[pastDueBalance = 0]" condition. You can also use combined fragments for more complicated conditional logic.
Actor (object) – this is at the top of the sequence diagram and represents an object interacting with the system. Objects, or actors, represent various roles, such as users or external systems.
In the sequence diagram, you can use a combined fragment with an alt
operator. This allows you to show alternative behaviors:
[condition]
). Example:
Additional reading:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With