Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

PlantUML: keyword arguments

Functions, procedures can also be called using keyword arguments, i.e, by using argument names.

Example

!function $sum($a, $b)
	!global $counter = $counter + 1
	!return $a + $b
!endfunction

 

Above function can be called in following ways.

$sum($b=45, $a=5)
$sum($b=45, 5)
$sum(5, 45)

keywordArguments.txt

@startuml

!global $counter = 1

!function $sum($a, $b)
	!global $counter = $counter + 1
	!return $a + $b
!endfunction

sys1 -> sys2 : $counter. sum of 5 and 45 is $sum($b=45, $a=5)
sys1 -> sys2 : $counter. sum of 5 and 45 is $sum($b=45, 5)
sys1 -> sys2 : $counter. sum of 5 and 45 is $sum(5, 45)

@enduml

Above snippet generate below diagram.




 

  

Previous                                                    Next                                                    Home


This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here

Share the post

PlantUML: keyword arguments

×

Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×