Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

Empty while condition doesn't work

0 votes
I'm considering to use PlantUML. One thing I have stumbled across is the strange use of diamond shapes in the activity diagram. I don't know if it is really UML compliant to write a question in the diamond shape -- at least I don't know of any other tool that does it. And I certainly don't like it.

I found, however, that I can get the commonly used diagrams by using empty conditions and labels with square brackets. But there is one exception:


 while () is ([cond met])
   :Do it;
 endwhile ([else])


doesn't work. I have to put at least one space between the braces after "while" (which ruins the diamond shape).

As it is possible to use an empty conditions in "if () then ([cond met])" and "repeat while () is ([cond met])" I think this is a bug.
asked Feb 9 in bug by mnlipp (240 points)

1 Answer

0 votes
Best answer

Yes, it is indeed not very consistent.

So here is a beta that fix the while() issue:

About writing a question in the diamond shape, your question looks similar to http://plantuml.sourceforge.net/qa/?qa=5335/activity-beta-conditional-user-input-or-check

If you can provide us some drawing example from other tools on how they display questions (so not it diamond shape), we would be glad to considere enhancing PlantUML.

Finally, there is a not-very-documented setting that allows to display differently diamond shape:

skinparam conditionStyle diamond
while (ITERATE consolidatedYears) is ([next <b>consolidatedYear</b>])
  if (revision code in year?) then ([no])
    if (test) then (yes)

I don't know if it's what you are looking for.

answered Feb 9 by plantuml (117,910 points)
selected Feb 9 by mnlipp
Thanks! The "skinparam conditionStyle diamond" is a good workaround, because with this, the empty space in the braces after the while doesn't show.

IMHO UML doesn't have "questions" at all, so the question where to put them doesn't arise. All you have in UML is a decision node and two or more outgoing transitions with guard conditions (e.g. http://www.sparxsystems.com/resources/uml2_tutorial/uml2_activitydiagram.html or http://agilemodeling.com/style/activityDiagram.htm#DecisionPoints). The modelling tools that I know of (e.g. Together [my first], Papyrus, ArgoUML) don't allow you to specify something like "a question".
Support This Project Offer 250 Mo! Follow PlantUML on Twitter