null
An object with no value — a placeholder, like a missing chair at a table or the food on an empty plate. Written null or nil. May be used anywhere an object is used, but methods or filters that require a value can behave unexpectedly.
Reserved symbols (null, true/false, empty, blank, first, last, size, etc.) and where they can be used.
An object with no value — a placeholder, like a missing chair at a table or the food on an empty plate. Written null or nil. May be used anywhere an object is used, but methods or filters that require a value can behave unexpectedly.
{%- if null -%}
<p>unreachable, since null is falsy alone</p>
{%- else -%}
<p>null is falsy alone</p>
{%- endif -%}
{%- if null is_valid -%}
<p>unreachable, since null fails is_valid</p>
{%- else -%}
<p>null fails is_valid</p>
{%- endif -%}
{%- if empty -%}
<p>empty is truthy alone</p>
{%- endif -%}
{%- if empty is_valid -%}
<p>unreachable, since empty fails is_valid</p>
{%- else -%}
<p>empty fails is_valid, even though it is truthy alone</p>
{%- endif -%}The empty string (""). In a conditional, empty also matches an empty list. Used alone, empty evaluates as true; with is_valid it evaluates as false.
{%- if null -%}
<p>unreachable, since null is falsy alone</p>
{%- else -%}
<p>null is falsy alone</p>
{%- endif -%}
{%- if null is_valid -%}
<p>unreachable, since null fails is_valid</p>
{%- else -%}
<p>null fails is_valid</p>
{%- endif -%}
{%- if empty -%}
<p>empty is truthy alone</p>
{%- endif -%}
{%- if empty is_valid -%}
<p>unreachable, since empty fails is_valid</p>
{%- else -%}
<p>empty fails is_valid, even though it is truthy alone</p>
{%- endif -%}