first

Returns the first item of an array.

Input

{{ "Ground control to Major Tom." | split: " " | first }}

Output

Ground

Input

{% assign my_array = "zebra, octopus, giraffe, tiger" | split: ", " %}

{{ my_array.first }}

Output



zebra

You can use first with dot notation when you need to use the filter inside a tag:

{% if my_array.first == "zebra" %}
  Here comes a zebra!
{% endif %}