Skip to content

Commit

Permalink
Rewrite an example
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Oct 20, 2023
1 parent 86f5bdc commit fd3f179
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,11 @@ The following operators don't fit into any of the other categories:
(this is syntactic sugar for the :doc:`range<functions/range>` function):

.. code-block:: twig
{# join filter is applied to avoid Array to string conversion exception #}
{{ (1..5)|join(', ') }}
{# equivalent to #}
{{ range(1, 5)|join(', ') }}
{% for i in 1..5 %}{{ i }}{% endfor %}
{# is equivalent to #}
{% for i in range(1, 5) %}{{ i }}{% endfor %}
Note that you must use parentheses when combining it with the filter operator
due to the :ref:`operator precedence rules <twig-expressions>`:
Expand Down

0 comments on commit fd3f179

Please sign in to comment.