case

Match a single variable against multiple possible values using when statements for clean multi-branch logic.

Syntax

{% case variable %} {% when value %} ... {% else %} ... {% endcase %}

Example

{% assign tier = "gold" %}{% case tier %}{% when "gold" %}Gold Benefits{% when "silver" %}Silver Benefits{% else %}Basic Info{% endcase %}

Output

Gold Benefits

The case tag initiates a multi-way switch statement that inspects a single variable and matches it against discrete values declared with when tags. It provides a readable alternative to lengthy if-elsif chains.

On keyword combination landing pages, case statements organize layouts around product types or service models. For example: {% case row.service_type %}{% when 'emergency' %}24/7 on-call dispatch.{% when 'scheduled' %}Flexible booking windows.{% else %}Standard service.{% endcase %}. This structures copy cleanly.

Try this syntax in the editor.