marten
marten copied to clipboard
Add `{{ loop.odd? }}` and `{{ loop.even? }}` properties to the for loop variable
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 %}