case


Like if and unless tags, case tags controls the display of information by choosing between a list of candidates.


Syntax


{% case <Condition> %}

{% when <Match> %}

<Template Block>

{% endcase %}



Arguments

Condition - A string literal or name of the input parameter used as the comparison


Match - Candidates for comparison. The first candidate that matches the condition displays its respective template block.


Example:

InputParameter Value


'Orange'



Input


My favorite animal is:{% case InputParameter %}

{% when 'Black' %}

Zebra

{% when 'Blue' %}

Regal Tang

{% when 'Green' %}

Iguana

{% when 'Orange' %}

Fox

{% when 'Yellow' %}

Duck

{% endcase %}



Output


My favorite animal is:

Fox