case/when

Creates a switch statement to compare a variable with different values.

case initializes the switch statement, and when compares its values.

Input
  • {% assign foo = 'banana' %}
    {% case foo %}{% when 'apple' %}Susy had an apple{% when 'banana' %}Susy had a banana{% else %}Susy did not have an apple or a banana{% endcase %}
Output
  • Susy had a banana