# case

- `(`case` EXPRESSION ((CHOICE CHOICE ...) EXPRESSION) ((CHOICE CHOICE ...) EXPRESSION) ...)`
  A `case` form contains an expression and one or more branches, or "lines". Each line contains a sequence of choices --- numbers and names for symbols --- and an answer expression. The initial expression is evaluated, and the resulting value is compared to the choices in each line, where the lines are considered in order. To evaluate a line, first check whether the value is one of the choices. If so, then the result of the whole `case` is the result of evaluating the answer expression of the line. If the value is not one of the choices, the line is discarded and evaluation proceeds with the next line. If none of the lines contains a matching choice, it is an error.
- `(`case` EXPRESSION ((CHOICE CHOICE ...) EXPRESSION) ... (`else` EXPRESSION))`
  This form of `case` is similar to the prior one except that the final `else` clause is always taken if no prior line's choices match. In other words, there is no possibility that evaluation will "fall off the end" of the `case` expression.

Advanced Student Language