--- title: "The Case Tag" slug: "case-tags-in-liquid-markup" updated: 2026-04-16T19:39:14Z published: 2026-04-16T19:39:14Z canonical: "knowledge.technolutions.net/case-tags-in-liquid-markup" --- > ## Documentation Index > Fetch the complete documentation index at: https://knowledge.technolutions.net/llms.txt > Use this file to discover all available pages before exploring further. # The Case Tag In [Liquid markup](/v1/docs/getting-started-with-liquid-markup), the `case` tag lets you create an array of outputs that depend on the value of a given export. In the **case** of a person reading your email: **when** they are an inquiry, they’ll receive a welcome message; **when** they are an applicant, they’ll instead find next steps on their application. ## How to use `case` `case` works like the conditional tag `if`, but with a little more structure: - Case blocks begin with the `case`, followed by the export you want Slate to evaluate. In our example, `{% case export %}`. - The exports are themselves followed by one or more `when` conditions, each corresponding to a potential value the export might have: `{% when export-value-1 %}`, `{% when export-value-2 %}`, and so on. - An optional (but recommended) `else` tag catches `case`s without any matching `when`s: `{% else %}` - Finally, it is closed with an `endcase` tag. All together: ```plaintext {% case export %}    {% when export-value-1 %}        Output for Export Value 1    {% when export-value-2 %}        Output for Export Value 2    {% else %}        Fallback if no when conditions are satisfied {% endcase %} ``` #### Examples Present different calls to action depending on the recipient’s person status, or else an opportunity to update their profile if they have no status: ```plaintext {% case {{Person-Status}}%}    {% when "Inquiry" %}        Welcome {{Person-Preferred}}! We're so excited that you're interested in exploring Slate University. Check out our upcoming events!    {% when "Applicant" %}        Hello {{Person-Preferred}}! Feel free to reach out if you have any questions about your application!    {% when "Current Student" %}        Hello {{Person-Preferred}}, Check in with the Student Activities and Student Life Office to explore extracurriculars at Slate University    {% when "Alumnit" %}        Hello {{Person-Preferred}}, Stay connected with our alumni network for exclusive events and opportunities.    {% else %}        Welcome to Slate University! Please update your profile to get the most relevant information. {% endcase %} ``` Show a student different material based on the value in their `major` field, or else give them an interdisciplinary course if they don’t have a major yet: ```plaintext {% case student.major %}    {% when "Computer Science" %}        This course dives into advanced algorithms, perfect for Computer Science majors looking to deepen their programming skills.    {% when "Business" %}        This course covers the essentials of data analysis, ideal for Business majors interested in data-driven decision-making.    {% when "Art" %}        Explore digital tools for creating innovative art, a must-take for Art majors focusing on digital media.    {% else %}        Discover this interdisciplinary course, designed to appeal to students from all majors. {% endcase %} ``` ## When to use `case` over `if` `case` tags are designed specifically for scenarios where evaluation of a **single export** against multiple values is necessary. `if` tags, on the other hand, require either `if` or `elsif` tags for each condition, which is wordier and can be harder to maintain. Take the following examples. Both deliver the same outcome to the end user, one using `case` and `when` tags, the other using `if` and `elsif` tags: Using the case tagUsing if and elsif tags ```plaintext {% case {{applicant_type}} %}    {% when "full-time" %}        Full-time student message    {% when "part-time" %}        Part-time student message    {% when "alumni" %}        Alumni message    {% else %}        Default message {% endcase %} ``` ```plaintext {% if {{applicant_type}} == "full-time" %}    Full-time student message {% elsif {{applicant_type}} == "part-time" %}    Part-time student message {% elsif {{applicant_type}} == "alumni" %}    Alumni message {% else %}    Default message {% endif %} ``` #### Readability In this example, the `case` tag is more readable and succinct as it compares the same export, like `applicant_type`, against its multiple values. The `if` tag makes you to call the `applicant_type` export every time. #### Performance The `case` tag has added performance benefits: it evaluates the expression once and matches it against all possible outcomes, whereas each individual `if/elsif` tag must be evaluated separately. While this might not be a critical factor, it can cause efficiency issues as your Liquid markup gets more complex. #### Flexibility Here, `if` has the edge. `case` tags allow for a fixed set of potential values to compare against, while `if` *tags* are better off evaluating complex conditions, or when those conditions are not just simple value comparisons. **📖** See the [Shopify documentation on case tags](https://shopify.dev/docs/api/liquid/tags/case).