判断是否是最后一条
在 list 循环中,有两个特殊的循环变量可用:item_index :这是一个包含当前项在循环中的步进索引的数值。
item_has_next :来辨别当前项是否是序列的最后一项的布尔值。
示例 1:
<#assign seq = ["winter", "spring", "summer", "autumn"]>
<#list seq as x>
${x_index + 1}. ${x}<#if x_has_next>,</#if>
</#list>
<#assign x=3>
<#list 1..x as i>
${i}
</#list>
<#list seq as x>
${x}
<#if x = "spring"><#break></#if>
</#list>
注意如果你