What is the Syntax for "for" loop in Plantuml

+1 vote
asked May 19, 2019 in Question / help by anonymous
commented May 20, 2019 by albert (3,520 points)
Please show what you want, what type of diagram?

Did you try to google e.g. plantuml for loop

and look at the hit (in my case the top one): http://plantuml.com/sequence-diagram
commented May 20, 2019 by anonymous
Hi,

i want the "for-loop" syntax for Activity diagram.

i did try to google, but i didnt get the ones for activity diagrams.

the ones mentioned for sequence diagram doesnt work for me.
commented Mar 24, 2022 by boldandbusted (280 points)
Yes, can I use for loops across the PlantUML language, irrespective of object type? :)

1 Answer

+1 vote
answered Mar 24, 2022 by Martin (8,360 points)

I guess you can represent a FOR loop in an activity diagram using a repeat while loop, eg

@startuml
start

repeat :For i=1 to 10;
  :print i;
repeat while (next i)

stop
@enduml

@boldandbusted - I don't understand your question "can I use for loops across the PlantUML language, irrespective of object type?".  I mean loops only really make sense when you are drawing an activity diagram...  Did you have a diagram type in mind?

commented Mar 24, 2022 by boldandbusted (280 points)
@Martin Thanks for chiming in. I'm not looking for support for *diagramming* a for loop - I know that's in there. What I'm looking for is a way to *execute* for loops within the PlantUML language. But, I think I found a workaround approach that uses "!while" loops, with some problems for me, but that's covered in another post I created a few minutes ago. :)
commented Mar 24, 2022 by The-Lu (64,340 points)

Hello all,

Yes, on Preprocessing you can use:

or 

If that can help,
Regards.

...