Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Upgrade

Template Filter - last


Return the last item in a list:

<h1>{{ fruits|last }}</h1>
Run Example »

Definition and Usage

The last filter returns the last item of an object.

For strings, the last filter returns the last character:


Return the last character of a string:

<h1>{{ firstname|last }}</h1>
Run Example »

Use the first filter to return the first item.


Template filters are defined by using a pipe | character followed by the name of the filter.

{{ value|last }}