1``last``
2========
3
4The ``last`` filter returns the last "element" of a sequence, a mapping, or
5a string:
6
7.. code-block:: twig
8
9    {{ [1, 2, 3, 4]|last }}
10    {# outputs 4 #}
11
12    {{ { a: 1, b: 2, c: 3, d: 4 }|last }}
13    {# outputs 4 #}
14
15    {{ '1234'|last }}
16    {# outputs 4 #}
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