case, when, and else Tags
Creates a switch statement looking for the first when match for the value passed to
case.
Description
Creates a switch statement looking for the first when match for the value passed to
case. When a match is found, it executes the code within that when
block.
else can optionally be used to catch cases where there was no matching
when.
{% assign day_of_week = 'now' | date: '%A' %}
{% case day_of_week %}
{% when 'Monday' %}
Looks like somone has a case of the Mondays!
{% when 'Friday' %}
If you could come in on Saturday, that would be greeeeaaat.
{% when 'Saturday' %}
Yeah, I'm going to need for you to come in on Sunday too.
{% else %}
Did you get the memo?
{% endcase %}
Parameters
None.