Friday 29 September 2023

PlantUML: How to Stop an Action on an If Condition

We can use the ‘stop’ keyword in if condition.

stopOnAction.txt

@startuml

!pragma useVerticalIf on
start

if (database credentials  configured) then (no)
	#pink :Print 'no database credentias found and exit';
	stop
else (yes)
   if (port 8080 is available) (no)
     #pink : Print 'Port 8080 is not available and exit';
     stop
   else (yes)
   	 #palegreen : Print 'Initializing the application';
   endif
endif

stop

@enduml

 Above snippet generate below diagram.

 


But, if you want to stop at a precise action, you can use either kill or detach keywords.

 

killOrDetach.txt

@startuml

!pragma useVerticalIf on
start

if (database credentials  configured) then (no)
	#pink :Print 'no database credentias found and exit';
	kill
else (yes)
   if (port 8080 is available) (no)
     #pink : Print 'Port 8080 is not available and exit';
     detach
   else (yes)
   	 #palegreen : Print 'Initializing the application';
   endif
endif

stop

@enduml

 

Above snippet generate below diagram.

 


 

  

Previous                                                    Next                                                    Home

No comments:

Post a Comment