You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by "Daniel Dekany (JIRA)" <ji...@apache.org> on 2016/11/01 19:08:58 UTC

[jira] [Commented] (FREEMARKER-37) ability to skip iteration in a list

    [ https://issues.apache.org/jira/browse/FREEMARKER-37?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15626370#comment-15626370 ] 

Daniel Dekany commented on FREEMARKER-37:
-----------------------------------------

The problem is deeper than that, because {{#list}} isn't just an odd name for {{for}}. {{#list}} deals with things like item separators, item index, etc. Thus if you skip items like that (with a big {{#if}} or a {{#continue}]), you can't use those features. So the real solution would be list filtering... which is a more difficult problem than {{#continue}}. So, yeah, skipping is badly needed, but {{#continue}} is not the good solution for it.

> ability to skip iteration in a list
> -----------------------------------
>
>                 Key: FREEMARKER-37
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-37
>             Project: Apache Freemarker
>          Issue Type: Improvement
>            Reporter: Ivan Levchenko
>
> Sorely missing ability to skip through an iteration of a list and continue on with the rest of the list. would like to write clean code like this:
> <#list collection as element>
>         <#if element.attr1 == "some_value"> 
>                 <#continue />  <#-- skip over this item and run next item in loop -->
>         </#if>
>     do stuff here
> </#list>
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)