blob: 0015cae1f9ad4e8cb99298f19fc8fa90be3f40c6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
``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 %}
Arguments
---------
* ``position``: The cycle position
|