While condition in several lines

+2 votes
asked Jul 17, 2020 in Wanted features by Aurélien
In the activity diagram (beta), is it possible to allow the while condition in several lines?

In the if/else condition, it is possible to have several lines by adding a \n like this:

if( condition\n
on several lines) then (yes)

    :my activity;

endif

For the while, it could be the same:

while(condition\n
on several lines) is (yes)

    :my activity;

endwhile(no)

But actually, it generates an error.
commented Jul 17, 2020 by Martin

I'm not sure if you realise that the "\n" in your 'if' example is not allowing you to run over multiple lines, it is actually adding an extra line feed into the text.

You could have alternatively written (note the blank line in place of the \n):

@startuml
if( condition
 on several lines) then (yes)
     :my activity;
 endif
@enduml

to achieve the same effect.

But I agree that it is inconsistent that 'if' text can run over multiple lines, but 'while' text can't.

(As pointed out below, you can use the single line "\n" notation instead.)

2 Answers

0 votes
answered Jul 17, 2020 by plantuml (295,000 points)
0 votes
answered Jul 17, 2020 by The-Lu (64,340 points)

Hello A.,

For more precision, in fact that generates on error only if that is on several line.
But if we use '\n' on one line that is good:
One-line: OK
@startuml
while (condition\non several lines) is (yes)
    :my activity;
endwhile (no)
@enduml
Multi-line: KO
@startuml
while (condition
on several lines) is (yes)
    :my activity;
endwhile (no)
@enduml
If that can help,
Regards,
Th.
...