Change theme:   


Cycle is usually used within a loop to alternate between values, like colors or DOM classes.

  {% for item in items %}
    <div class="{% cycle 'red', 'green', 'blue' %}"> {{ item }} </div>
  {% end %}

   <div class="red"> Item one </div>
   <div class="green"> Item two </div>
   <div class="blue"> Item three </div>
   <div class="red"> Item four </div>
   <div class="green"> Item five</div>

Cycles can also be grouped so you can perform calls on multiple cycles.

{% cycle 'fruits': 'apple', 'orange', 'banana' %},
{% cycle 'beverages': 'beer', 'soda', %},
{% cycle 'fruits': 'apple', 'orange', 'banana' %},
{% cycle 'beveraces': 'beer', 'soda' %}

# Output:
apple, beer, orange, soda