Tuesday, 7 May 2024

PlantUML: Define a variable

PlantUML support two types of variables.

a.   Integers

b.   Strings: Enclosed in either single or double quotes

 

You can define a variable using $.

!$radius1 = 2
!$radius2 = "2.3456"

! (exclamation mark) is used to define preprocessing capabilities.

 

variables.txt

@startuml

!$radius1 = 2 !$radius2 = "2.3456" !$msg = "Calculate area of circle for the radius : " !$payload1 = $msg + $radius1 !$payload2 = $msg + $radius2 Client -> Server: $payload1 Server -> Client: Send response Client -> Server: $payload2 Server -> Client: Send response @enduml

Above snippet generate below diagram.


 

Previous                                                    Next                                                    Home

No comments:

Post a Comment