For the complete documentation index, see llms.txt. This page is also available as Markdown.

array

The array keyword literal may be used in any Liquid code to instantiate an array.

Arrays support assignment by index. Many other operations are supported using array filters.

Example

{% assign weekdays = array %}
{% assign weekdays[0] = "Monday" %}
{% assign weekdays[1] = "Tuesday" %}
{% assign weekdays[2] = "Wednesday" %}
{% assign weekdays[3] = "Thursday" %}
{% assign weekdays[4] = "Friday" %}
{% assign weekdays[5] = "Saturday" %}
{% assign weekdays[6] = "Sunday" %}

{% for weekday in weekdays %}
  {{ forloop.index0 }}: {{ weekday }}
{% endfor %}

{% assign weekdays[weekdays.size] = "A NEW WEEKDAY, DYNAMICALLY INDEXED???" %}

Last updated

Was this helpful?