You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
pico/lib/twig/doc/functions/cycle.rst

20 lines
376 B

``cycle``
=========
The ``cycle`` function cycles on an array of values:
.. code-block:: jinja
{% for i in 0..10 %}
{{ cycle(['odd', 'even'], i) }}
{% endfor %}
The array can contain any number of values:
.. code-block:: jinja
{% set fruits = ['apple', 'orange', 'citrus'] %}
{% for i in 0..10 %}
{{ cycle(fruits, i) }}
{% endfor %}