MagicDraw 19.0 LTR Documentation


The #foreach directive will iterate through a list of variables and assign it to a local variable, for example:

#foreach ($localClass in $Class) 
 $localClass.name 
 #end


The above example shows that $Class is a list of class elements in MagicDraw. The #foreach directive will iterate through the $Class list and assign the value in the list to $localClass in each iteration. The code between #foreach and #end will be processed and the result will print the class name in each iteration. For example, if $Class contains class elements named "a", "b", and "c", the output from the above example will be:

a 
b 
c

 

  • No labels