首页 > 代码库 > list, break

list, break

语法

<#list sequence as item>  ...  <#if item = "spring"><#break></#if>  ...  </#list>

 

关键字

item_index:是list当前值的下标

item_has_next:判断list是否还有值

 

 用例

<#assign seq = ["winter", "spring", "summer", "autumn"]>  

<#list seq as x>   

   ${x_index + 1}. ${x}

   <#if x_has_next>,</#if>  

</#list>

输出  

1. winter,  

2. spring,   

3. summer,   

4. autumn 

list, break