marten icon indicating copy to clipboard operation
marten copied to clipboard

Add `{{ loop.odd? }}` and `{{ loop.even? }}` properties to the for loop variable

Open ellmetha opened this issue 1 year ago • 0 comments

Description

In order to make it easier to implement specific templates with for loops, let's ensure that the loop contextual variable also provides odd? and even? attributes.

For example:

{% for x in items %}
  {% if loop.even? %}
    Do something...
  {% else %}
    Do something else...
  {% endif %{
{% endfor %}

ellmetha avatar Mar 05 '24 14:03 ellmetha