From 4f7e216523d8eefe583dc22d8691d5453bcef5cf Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 17 May 2019 14:21:51 +0200 Subject: [PATCH] remove obsolete docs --- doc/tags/for.rst | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/doc/tags/for.rst b/doc/tags/for.rst index 0bc5b9db1..3aca508b0 100644 --- a/doc/tags/for.rst +++ b/doc/tags/for.rst @@ -80,46 +80,6 @@ Variable Description ``loop.last`` variables are only available for PHP arrays, or objects that implement the ``Countable`` interface. -Adding a condition ------------------- - -.. tip:: - - As of Twig 2.10, use the :doc:`filter <../filters/filter>` filter instead, - or an ``if`` condition inside the ``for`` body (if your condition depends on - a variable updated inside the loop and you are not using the ``loop`` - variable). - -Unlike in PHP, it's not possible to ``break`` or ``continue`` in a loop. You -can however filter the sequence during iteration which allows you to skip -items. The following example skips all the users which are not active: - -.. code-block:: twig - - - -The advantage is that the special loop variable will count correctly thus not -counting the users not iterated over. - -If you need to skip items "dynamically", use an ``if`` tag within the ``for``'s -body: - -.. code-block:: twig - - - The `else` Clause -----------------