To use this language, use the class "language-liquid".
{% comment %}This is a comment{% endcomment %}
{% if customer.name == 'kevin' %}
Hey Kevin!
{% elsif customer.name == 'anonymous' %}
Hey Anonymous!
{% else %}
Hi Stranger!
{% endif %}
if
– executes a block of code only if a certain condition is not met.
{% unless product.title == 'Awesome Shoes' %}
These shoes are not awesome.
{% endunless %}
case
initializes the switch statement, and when
compares its values.
{% assign handle = 'cake' %}
{% case handle %}
{% when 'cake' %}
This is a cake
{% when 'cookie' %}
This is a cookie
{% else %}
This is not a cake nor a cookie
{% endcase %}
{% for i in (1..10) %}
{% if i == 4 %}
{% break %}
{% elsif i == 6 %}
{% continue %}
{% else %}
{{ i }}
{% endif %}
{% endfor %}
{% for i in (3..5) %}
{{ i }}
{% endfor %}
{% assign num = 4 %}
{% for i in (1..num) %}
{{ i }}
{% endfor %}