Strings are declared by wrapping a variable's value in single or double quotes.
Numbers include floats and integers.
Booleans are either
false. No quotations are necessary when declaring a boolean.
Nil is a special empty value that is returned when Liquid code has no results. It is not a string with the characters "nil".
Nil is treated as false in the conditions of
if blocks and other Liquid tags that check the truthfulness of a statement.
In the following example, if a tracking number does not exist (that is,
nil), Liquid will not print the text:
Tags or outputs that return
nil will not print anything to the page.
Arrays hold lists of variables of any type.
Accessing items in arrays
Accessing specific items in arrays
You can use square bracket
] notation to access a specific item in an array. Array indexing starts at zero.
You cannot initialize arrays using only Liquid.
You can, however, use the split filter to break a single string into an array of substrings.
An EmptyDrop object is returned if you try to access a deleted object (such as a page or post) by its handle. In the example below,
page_3 are all EmptyDrop objects.
Checking for emptiness
You can check to see if an object exists or not before you access any of its attributes.
If you don't check for emptiness first, Liquid might print empty HTML elements:
You can check for emptiness with collections as well:
EmptyDrop objects only have one attribute,
empty?, which is always true.
Collections and pages that do exist do not have an
empty? attribute. Their
empty? is “falsy”, which means that calling it inside an
if statement will return false. When using an
unless statement on existing collections and pages,
empty? will return
If you need to check if a drop is empty, rather than using the
empty? attribute, use a conditional statement to check whether the drop is equal to