Control Flow

Control flow tags can change the information Liquid shows using programming logic.

if

Executes a block of code only if a certain condition is true.

Input

Output

These shoes are awesome!

unless

The opposite of if – executes a block of code only if a certain condition is not met.

Input

Output

These shoes are not awesome.

This would be the equivalent of doing the following:

elsif / else

Adds more conditions within an if or unless block.

Input

Output

Hey Anonymous!

case/when

Creates a switch statement to compare a variable with different values. case initializes the switch statement, and when compares its values.

Input

Output

This is a cake

Got an issue? Or want to submit feedback?

Our new Feedback and Issue Tracker is built on GitHub Issues. Just leave your comment below and you can track our team resolve it, or browse issues others have already submitted.

Read how to use the Feedback and Issue Tracker