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

PlantUML: preprocessing: procedures

PlantUML support procedures, where you can define once and reuse.

 

a.   Procedure names should start with a $

b.   Argument names should start with a $

c.    Procedures can call other procedures

 

procedures.txt

@startuml

!procedure $fib($arg)

	!$a = 0
	!$b = 1
	!$counter = 0
	!$fib = 0

	!while $counter arg
		#DarkSalmon:for the iteration $counter;
		#palegreen:a=$a, b=$b;

		!$fib = $a + $b
		!$a = $b
		!$b = $fib

		#palegreen:fib=$fib;

		!$counter = $counter + 1

	!endwhile

!endprocedure


start
	$fib(5)
end

@enduml

Above snippet shows what is happening in each iteration of fibonacci number calculation.

 


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: preprocessing: procedures

×

Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×