[#set name : type = value]
or
[#set name1 : type1 = value1
name2 : type2 = value2
...
nameN : typeN = valueN]
or
[#set name]
assigned value
[/#set]
where:
The set directive declares and initializes variables for use within the template. With this you can create a new variable, or replace an existing variable. As a convenience feature, you can do more than one assignment with one set tag.
Creates a String variable and initializes its value:
[#set myString = "Hello World"]
Creates a List variable and initializes its value:
[#set seasons = ["winter", "spring", "summer", "autumn"]]
Create the two variables in one set directive:
[#set myString = "Hello World"
seasons = ["winter", "spring", "summer", "autumn"]]
Assigns the type of a UML operation to a variable:
[#set theType : uml21.Type = myOperation.type]
Assigns a multiline text to a variable:
[#set largeString]
Some multi line text
with dynamic text ${myFeature.name}
[/#set]