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 %}
Description
In order to make it easier to implement specific templates with for loops, let's ensure that the
loop
contextual variable also providesodd?
andeven?
attributes.For example: