array
Some attributes of the exposed variables are arrays. This means they're a representation of a collection of objects. They all share the same attributes:
name | type | description |
---|---|---|
any? | boolean | returns true if the collection is not empty, returns false otherwise |
empty? | boolean | returns true if the collection is empty, returns false otherwise |
first | object | returns the first object of the collection |
last | object | returns the last object of the collection |
size | number | returns the number of items of the collection |
You can iterate through an array using the Liquid's for
loop:
{% for course in courses.enrolled %}
{{ course.name }}
{% endfor %}
Updated over 3 years ago