Just released: Developer preview of Microsoft Teams bot integration for Now Assistant. Try with your Teams ×

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