In case you just need the index, then you can do:
<#list myList as item>
${item?index} ${item}
</#list>
(Note that ?index
only exists since 2.3.23; before that, use the legacy item_index
variable.)
You can also use <#if limit < item_index><#break></#if>
to break out of the loop, if that's what's needed.
If you really need to iterate with an index, use <#list 0..<count>
(that's an exclusive-end range expression there, from ..< to
), as there's no item at the count
index.