Exit from while loop creates duplicate activity node

0 votes
asked May 2, 2019 in Bug by Ashwin
edited May 2, 2019

Hi Team,

After exiting from a loop, i want to go back to an activity node that has already been defined but plantUML ends up creating a duplicate activity node

@startuml

start

if (conditionTrue?) then (true)

:DoSomething;

else

while (data available?)

  :read data;

  :generate diagrams;

endwhile

    :DoSomething;

endif

stop

@enduml

Is this a bug?

Sample output generated using https://www.planttext.com/ : https://tinyurl.com/y6hvhb3s

1 Answer

0 votes
answered May 2, 2019 by Serge Wenger Work (14,600 points)
Hello,

For me it is not a bug. How did you code this with your favorite language (c#, java, etc)?

You can try to use connector, but it is not perfect
commented May 3, 2019 by Serge Wenger Work (14,600 points)
edited May 3, 2019 by Serge Wenger Work
Hello,
 It is not possible to code with a language like C# or java what you want to do without a Goto, which is not appropriate in my opinion. It is why, it is not possible with Activity diagram.

I create the diagram with the "goto"

http://www.plantuml.com/plantuml/png/7Ov1heCm34JtSmelmnLWyVaIDsWlu193B0Md2gQzVaDsVhOyy-RJkVfrPFG1q8t2MYogQx5dlUHl84zY5Bp1WF0_O5pAenpYIMsV0Ccd0D-aMIX4TYR-i6P-vVOC48rLED9zcJhkObBPXQBoNlauxn2BFG6zOH7dDVMjRcXkvOsvGHFz0G00

Another possibility is to change a little bit the code and write

@startuml
start

if (conditionFalse?) then

while (data available?)

  :read data;

  :generate diagrams;

endwhile
endif

 :DoSomething;
@enduml

http://www.plantuml.com/plantuml/png/7Ox13S8m34NldiB7ia9xe0V40apm8MvYAN6anC3wJNDxVa-o_juTpRybqmGYFNZvL0lgMks9tEL-OqzYJFHFceMN00VZ1yruvv69cDSc27oLRPvHJ1fSE2XYG-b3YuNvuG8zY7Xzr5SjuaajRhGFFOQS
...