BUG: {% break %} not working within IF statement in forloop

@alex.n @vlad.z This should work but does not.

Putting a break tag with in an IF statment in a for loop does not work. IE:

{% assign loopCount = 0 -%}
{% for item in events_SortedByStartDate -%}
    {% assign theItemDate = ... -%}
    {% assign theCurrentDate = ... -%}
    {% if theItemDate > theCurrentDate -%}
       {% assign loopCount = loopCount | plus: 1 -%} 
        //render out the item HERE
    {% endif -%}

    {% if loopCount | abs == "6" %} THIS SHOULD BREAK HERE! {% break %} {% endif %}
{% endfor -%}

See Events list on home page.


After the 6 items rendered, the string appears but the loop does not break. :frowning:
Is it possible this can be fixed in the current sprint? :slight_smile:

Hi @James
This bug is with Liquid v2.0 only. We have added this bug to the buglist but it can’t be released in the current release since it is already in QA session (we don’t add tasks within this period).

So for now I suggest you to use liquid v1.0 for this site.