String, integer, number, and boolean — types with no child properties.
Simple object types have no child properties. They are the most basic kind of data. Complex objects often must be converted to a simple type before they can be used inside methods and filters.
string, integer, number, and boolean are documented on this page. Lists are not simple types — see Working with Lists. Reserved names such as null and empty are documented under Symbols.
string
Text with no child properties: the empty string (""), a single character ("a"), or the full HTML output of a rendered template. When used alone in a conditional, every string evaluates as true — including "", "0", and "false".
Strings can be enumerated with {% for %}, in which case each item is a single character. For most other purposes a string is a single value, so {% if "string" is_list %} is false.
ExampleEvery string, including "", "0", and "false", is truthy alonestring has no child properties; used alone in a conditional every string is truthy, even "", "0", and "false". {% for %} can enumerate a string's characters, but is_list still returns false.
Liquid
{%- if "" -%}
<p>the empty string is truthy alone</p>
{%- endif -%}
{%- if "0" -%}
<p>"0" is truthy alone</p>
{%- endif -%}
{%- if "false" -%}
<p>"false" is truthy alone</p>
{%- endif -%}
{%- if "cat" is_list -%}
<p>a string is a list</p>
{%- else -%}
<p>a string is not a list</p>
{%- endif -%}
<ul>
{%- for letter in "cat" -%}
<li>{{ letter }}</li>
{%- endfor -%}
</ul>
integer
A whole number with no child properties, including 0 and negatives (for example -2, -1, 0, 1, 2). Integers are a type of number. Any integer — including 0 — evaluates as true when used alone in a conditional.
ExampleZero and negative numbers are truthy alone; every integer is also a numberinteger and number have no child properties; used alone in a conditional any number, including 0, is truthy. Integers are a type of number.
Liquid
{%- if 0 -%}
<p>the integer 0 is truthy alone</p>
{%- endif -%}
{%- if -1 -%}
<p>a negative integer is truthy alone</p>
{%- endif -%}
{%- if 0.0 -%}
<p>the number 0.0 is truthy alone</p>
{%- endif -%}
{%- assign count = 3 -%}
{%- if count is_number -%}
<p>{{ count }} is a number, since every integer is also a number</p>
{%- endif -%}
number
A numeric value with no child properties: integers, decimals, or fractions, including 0. Integers are a type of number. Any number — including 0 — evaluates as true when used alone in a conditional.
ExampleZero and negative numbers are truthy alone; every integer is also a numberinteger and number have no child properties; used alone in a conditional any number, including 0, is truthy. Integers are a type of number.
Liquid
{%- if 0 -%}
<p>the integer 0 is truthy alone</p>
{%- endif -%}
{%- if -1 -%}
<p>a negative integer is truthy alone</p>
{%- endif -%}
{%- if 0.0 -%}
<p>the number 0.0 is truthy alone</p>
{%- endif -%}
{%- assign count = 3 -%}
{%- if count is_number -%}
<p>{{ count }} is a number, since every integer is also a number</p>
{%- endif -%}
boolean
True or false. The literals true and false may be used anywhere a boolean value is used.
ExampleUse the true and false literals anywhere a boolean is expectedboolean has no child properties. The literals true and false may be used anywhere a boolean value is expected, including as a variable value or a condition operand.
Liquid
{%- assign is_active = true -%}
{%- if is_active -%}
<p>is_active is true</p>
{%- endif -%}
{%- assign is_hidden = false -%}
{%- if is_hidden == false -%}
<p>is_hidden is false</p>
{%- endif -%}
{%- unless is_hidden -%}
<p>unless treats false as the negative case</p>
{%- endunless -%}