Liquex.Tag.CaseTag (liquex v0.10.2) View Source

Creates a switch statement to execute a particular block of code when a variable has a specified value. case initializes the switch statement, and when statements define the various conditions.

An optional else statement at the end of the case provides code to execute if none of the conditions are met.

Input

{% assign handle = "cake" %}
{% case handle %}
  {% when "cake" %}
    This is a cake
  {% when "cookie", "biscuit" %}
    This is a cookie
  {% else %}
    This is not a cake nor a cookie
{% endcase %}

Output

This is a cake

Link to this section Summary

Functions

Callback implementation for Liquex.Tag.parse/0.

Callback implementation for Liquex.Tag.parse_liquid_tag/0.

Callback implementation for Liquex.Tag.render/2.

Link to this section Functions

Callback implementation for Liquex.Tag.parse/0.

Callback implementation for Liquex.Tag.parse_liquid_tag/0.

Specs

render(list(), Liquex.Context.t()) :: Liquex.Render.result_t()

Callback implementation for Liquex.Tag.render/2.