case_statement ::= 'case' expression
( 'when' values 'then' block )\stern
[ 'else' block ] 'end' .
values ::= value ( ',' value )\stern .
Example: case neighbors when 1,5,6,7,8 then reset when 3 then toggle
else set end
A case statement is processed by evaluating the case expression. Then this value is compared to the values of the case labels. The case labels' values must be of boolean, character, or integer type. If the comparison with one of the values of a case label yields true then the subsequent block after this case label is processed. If none of the comparisons yields true and an else-clause was present, the block following else is processed.
The type of any case label must conform to the type of
the case expression. A value must occur at most once as a case
label.