]> git.immae.eu Git - github/wallabag/wallabag.git/blame - vendor/twig/twig/doc/functions/cycle.rst
gitignore vendor
[github/wallabag/wallabag.git] / vendor / twig / twig / doc / functions / cycle.rst
CommitLineData
4f5b44bd
NL
1``cycle``
2=========
3
4The ``cycle`` function cycles on an array of values:
5
6.. code-block:: jinja
7
8 {% for i in 0..10 %}
9 {{ cycle(['odd', 'even'], i) }}
10 {% endfor %}
11
12The array can contain any number of values:
13
14.. code-block:: jinja
15
16 {% set fruits = ['apple', 'orange', 'citrus'] %}
17
18 {% for i in 0..10 %}
19 {{ cycle(fruits, i) }}
20 {% endfor %}
21
22Arguments
23---------
24
25 * ``position``: The cycle position