Patterns Quiz
Below are the answers to the Patterns Quiz, along with a brief discussion.
1. An input is supplied to the pattern. A rule is evaluated for the input. An action is done if (and only if) the pattern matches. An output is produced from the pattern.
2. The constant pattern, type pattern, and var pattern.
3. Switch statements and the is keyword.
4. False. The type pattern only matches if the input is of the type in question.
5. True. The var pattern always matches, regardless of the type of the input.