Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 793 Bytes

File metadata and controls

26 lines (20 loc) · 793 Bytes

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

{% raw %}
{% 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???" %}
{% endraw %}