UML Course

alt and opt fragments

Go back

The fragment alt (=alternatives) allows us to use an if else, and opt (= optional) is allowing you to use an if in a sequence diagram.

alt

  • the ---- line is used each time we add an alternative
    • if there is no condition, this is an else
    • otherwise, this is an else if
  • the [...] is called the guard, and it's the condition of the if/else if