Although VTL in this user guide is often displayed with newlines and whitespaces, the VTL shown below
#set( $fruits = ["apple", "pear", "orange", "strawberry"] ) #foreach( $fruit in $fruits ) $fruit #end
is equally valid as the following snippet that Geir Magnusson Jr. posted to the Velocity user mailing list to illustrate a completely unrelated point:
Send me #set($foo=["$10 and ","a pie"])#foreach($a in $foo)$a#end please.
Velocity's behaviour is to gobble up excess whitespace. The preceding directive can be written as:
Send me #set( $foo = ["$10 and ","a pie"] ) #foreach( $a in $foo ) $a #end please.
or as
Send me #set($foo = ["$10 and ","a pie"]) #foreach ($a in $foo )$a #end please.
In each case the output will be the same.