Desired result
Repeat and while loops are just special cases. While they are common in code, in more high-level process descriptions I almost always need the general case, which looks something like this:
![@startuml state "before loop" as before state "inside the loop" as loop { state "loop join" as join <<choice>> state "before condition" as unconditional : empty in "while" loops state "loop condition" as test <<choice>> state "after condition" as continue : empty in "repeat" loops } state "after loop" as after before -d-> join : enter loop join -d-> unconditional unconditional -d-> test : condition test test -l-> after : break loop test -d-> continue : continue loop continue -u-> join : close loop continue -d[hidden]-> after @enduml](http://www.plantuml.com/plantuml/png/RP11ReCm54JtFiM8VIw08fHxL5qu-4UuDJR27rLLrRit6M9JgsNrP_IOORXajQjkSp3tGmNTLMvf5OIKbWvyRCPk5iJ7x9r0fuBPp0DV1dWor6_9nps4CTGudySf-L66eTAbT4pHUVKfCdABLTk07Z8l-WaVqNrCFaZ7pjnM_evWfKhMVoljJMLjS9iVKdtSf6bRPH6hfUxRD077Vs80JMEUUu2JEmtxx4TaB6-OtIf0izGqQWUueaVrQHYw30btXjMKFQwhs7Ss7H23wa3qnqskgjDMFnaW5rB-0xcNoJidyRKqcuj4jytX1m00)
Is there any way to achieve that already?
What doesn't work
Note that:
- Using a "while" loop for this makes an extra arc from the loop start to "after loop"
- Using a "repeat" loop for this makes an extra arc from the loop end to "after loop"
- Using "detach" or "kill" after the loop will remove or cut the arc from the condition test to "after loop"
Suggested Syntax
If it doesn't exist yet, this is how I would suggest to support it (new syntax in bold):
@startuml
:before loop;
repeat
:before condition;
if (condition test) then (break loop)
break
else (continue loop)
endif
:after condition;
repeat forever
:after loop;
@enduml