velocity: do something except in last loop iteration

后端 未结 4 1941
南方客
南方客 2021-01-03 19:41

In velocity, I want to do something different in the last loop.

What is the correct idiom?

RELATED: Last iteration of enhanced for loop in

4条回答
  •  [愿得一人]
    2021-01-03 20:05

    You can use a test if you are in last iteration::

    #foreach( $item in $list )
        $item.text #if( $foreach.hasNext ), #end
    #end
    

提交回复
热议问题