Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

range example leads to Array to string conversion exception #3892

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -751,12 +751,12 @@
* ``..``: Creates a sequence based on the operand before and after the operator
(this is syntactic sugar for the :doc:`range<functions/range>` function):

.. code-block:: twig

Check failure on line 754 in doc/templates.rst

View workflow job for this annotation

GitHub Actions / DOCtor-RST

Please add a blank line after " .. code-block:: twig

{{ 1..5 }}
{# join filter is applied to avoid Array to string conversion exception #}
{{ (1..5)|join(', ') }}

{# equivalent to #}
{{ range(1, 5) }}
{{ range(1, 5)|join(', ') }}

Note that you must use parentheses when combining it with the filter operator
due to the :ref:`operator precedence rules <twig-expressions>`:
Expand Down
Loading