Menu

#79 Add "continue" directive inside list

2.3.27
closed-fixed
nobody
None
5
2017-09-17
2011-08-19
No

Hi there,

as exposed in [1] you can use break directive to exit from a list loop: actually I would need a "continue" directive to go to the next item if some condition is verified.
EG:
<#assign seq = ["winter", "spring", "summer", "autumn"]>
<#list seq as x>
<#if x = "spring"><#continue></#if>
${x}
</#list>
This will simply not print spring skipping directly to next item.

What do you think about it?
Thanks
Bye
Piero

[1]http://freemarker.sourceforge.net/docs/ref_directive_list.html

Discussion

  • Dániel Dékány

    • labels: 1040385 -->
    • status: open --> open-accepted
     
  • Dániel Dékány

    I have no idea why do FTL has #break but no #continue... I assume it should be added. (One could say that just put the rest of the nested content into <#if x != "spring">, but for more complex cases that approach obviously won't work.) Only I really can't tell any deadlines for that...

     
  • Zefram Cochrane

    Zefram Cochrane - 2017-06-04

    It's now 2017 and still no <#continue> despite it being in so many other languages. Now I have to make my code ugly with another <#if> layer to achieve that otherwise simple effect. Ridonkulous.

     
  • Dániel Dékány

    Things like that happen when no contributor misses a feature in his work... it fellt through the cracks. I will try to get it into 2.3.27.

     

    Last edit: Dániel Dékány 2017-06-04
  • Dániel Dékány

    • status: open-accepted --> closed-fixed
    • Group: --> 2.3.27
     
  • Dániel Dékány

    Implemented in Git head (released in 2.3.27).

     

    Last edit: Dániel Dékány 2017-09-17

Log in to post a comment.