{case value} evaluates its value once and keeps only the branch of the first
{when} that matches it. A {when} may list several values separated by
commas - {when 'yellow', 'amber'} - and matches when any of them is equal. Each
value is an expression of its own, so {when $limit} or {when 2 * 5}
work too. The comparison is PHP's loose ==, so {when 3} matches the
text '3'.
A branch runs from its {when} to the next one (or to {else} or
{/case}). {else} opens the default branch, rendered when no
{when} matched; without it nothing renders in that case. {when 'default'}
is not a default - it is an ordinary branch matching the text default. A nested
{case} or {if} inside a branch keeps its own {when} and
{else}.
Under the strict syntax check the tag is held to its shape: a {case} without a
value, without any {when} or without its {/case} is an error; so is
text standing before the first {when} (it would never render), a {when}
behind the {else}, a {when} without a value, and a value listed twice
- only the first one could ever answer.
For a yes/no test use {if}; for a heading each time a value changes inside a loop, {ifchanged}.