Liqiud basics
Modules
API
Mailer
Conditions
On this page
Overview
Below is a list of all the available drops on the <insert name here> object
if
Executes a block of a code if a certain condition is true.
{% if litterature.title == "Advanced Potion Making" %}
This is a great book!
{% endif %}
This is a great book!
unless
The opposite of if – executes a block of code only if a certain condition is not met.
{% unless litterature.title == "Advanced Potion Making" %}
Maybe it's not such a good book after all.
{% endif %}
Maybe it's not such a good book after all.Unless the equivelent to the operator !=
elsif / else
Adds more conditions to a if or unless block.
{% if student.name == "harry" %}
Hey Harry!
{% elsif student.name == "ron" %}
Hey Ron!
{% else %}
Hi students of Hogwarts!
{% endif %}
case / when
Creates a switch statement to compare a variable with different values. 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 %}
This is a cakeUpdated: 2020-06-16