'plantuml - activity diagram: Decision node with three outgoing edges and [else] guard
Solution 1:[1]
For that you can use several else allowed by the 'old' syntax of activities :
@startuml
(*) --> if "" then
--> [[priority = 1]] "A"
else
--> [[priority = 2]] "B"
else
--> [[else]] "C"
endif
@enduml
Note it is not possible to directly use ]]
nor \]]
, both producing a syntax error, so I had to use ]
to close the bracket
Solution 2:[2]
A similar requirement for "Switch or multiple else branches" was discussed in the PlantUML Q&A, and they suggested the following approach which also worked for me:
@startuml
start
if (condition A) then (yes)
:Text 1;
elseif (condition B) then (yes)
:Text 2;
stop
elseif (condition C) then (yes)
:Text 3;
elseif (condition D) then (yes)
:Text 4;
else (nothing)
:Text else;
endif
stop
@enduml
Solution 3:[3]
this is another solution proposed in the PlantUML Q&A:
@startuml
start
switch (test?)
case ( condition A )
:Text 1;
case ( condition B )
:Text 2;
case ( condition C )
:Text 3;
case ( condition D )
:Text 4;
endswitch
stop
@enduml
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Till Kuhn |
Solution 3 | Leandro Maro |