14. VTL 格式化问题

虽然在本指南中的VTL经常显示在新行中或者有空格,但是下面的VTL

#set( $imperial = ["Munetaka","Koreyasu","Hisakira","Morikune"] )
#foreach( $shogun in $imperial )
    $shogun
#end

和下面的写法同样有效。

Send me #set($foo = ["$10 and ","a cake"])#foreach($a in $foo)$a #end please.

Velocity的行为并不受空格的影响,前述的指令也可以写成:

Send me
#set( $foo = ["$10 and ","a cake"] )
#foreach( $a in $foo )
$a
#end
please.

或者

Send me
#set($foo       = ["$10 and ","a cake"])
                 #foreach           ($a in $foo )$a
         #end please.

上面每种写法结果都一样。