1``first`` 2========= 3 4The ``first`` filter returns the first "element" of a sequence, a mapping, or 5a string: 6 7.. code-block:: twig 8 9 {{ [1, 2, 3, 4]|first }} 10 {# outputs 1 #} 11 12 {{ { a: 1, b: 2, c: 3, d: 4 }|first }} 13 {# outputs 1 #} 14 15 {{ '1234'|first }} 16 {# outputs 1 #} 17 18.. note:: 19 20 It also works with objects implementing the `Traversable`_ interface. 21 22.. _`Traversable`: https://secure.php.net/manual/en/class.traversable.php 23