case

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

Input

{% 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 %}

Output

This is a cake
PDF HTML Epub Powered by Read The Docs