Can a conditional have more than 2 branches with the new syntax for activity diagrams?

0 votes
asked Jun 18, 2014 in Wanted features by anonymous
edited Jun 18, 2014

With the old syntax for activity diagrams, it was possible (though maybe undocumented?) to have a conditional with more than 2 branches, the equivalent of a switch statement:

(*) --> if "test?" then
  --> [a] "A"
else
  --> [b] "B"
else
  --> [c] "C"
endif
 
But the more or less equivalent new syntax just gives a syntax error:
 
start
if (test?) then when a
  :A;
else when b
  :B;
else when c
  :C;
endif
 
Is it possible to have a 3 (or more) way test with the new syntax?  Thanks!

 

1 Answer

0 votes
answered Jun 20, 2014 by plantuml (223,180 points)

Hi,

You can have this:

@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

Sorry we did not document that before!

...