Activity diagram: Using if(...) is (...) syntax in ELSEIF

0 votes
asked Dec 26, 2022 in Question / help by moe101 (120 points)

Hi

Please compare the below two examples, each utilizing one of the two conditional syntaxes cited in the manual.

  1. if (...) then (...)
  2. if (...) is (...) then

example

It would appear the second syntax (example 2) is not rendered correctly?

commented Dec 26, 2022 by The-Lu (63,920 points)

It would appear the second syntax (example 2) is not rendered correctly?

You are right.

Because only `if` allow this form (with `equal` or `is`), and not yet `elseif`!

That is now a wanted request...

See the corresponding code here:

And:

Currently, a possible workaround is to don't use equals on elseif, as:

@startuml
:New Action;
if (a?) equals (1) then
 :Action 4;
elseif (a?) then (2) 
  :Action 5;
else (no)
  :Action 6;
endif
stop
@enduml

Regards.

commented Dec 26, 2022 by moe101 (120 points)
Thanks a million!

3 Answers

+1 vote
answered Jan 10, 2023 by plantuml (294,960 points)
selected Jan 11, 2023 by moe101
 
Best answer

This is now fixed in V1.2023.0

Thanks for the report!

commented Jan 11, 2023 by moe101 (120 points)

Works perfectly. Thank you!

–1 vote
answered Dec 26, 2022 by Todd Musheno (2,680 points)
What it seems you are trying to do is a switch clause, I would switch to switch.
commented Dec 26, 2022 by anonymous
the issue is, using the two syntax options results in different behavior
commented Dec 26, 2022 by The-Lu (63,920 points)

Yes, for your case you can use `switch`, as:

@startuml
start
switch (a?)
case ( 1 )
  :Action 4;
case ( 2) 
  :Action 5;
case ( no )
  :Action 6;
endswitch
stop
@enduml

Regards.

0 votes
answered Dec 26, 2022 by anonymous
...