Value Patterns and Multi-Value Matching
Value patterns are the simplest patterns—they match values equal to a specific literal. You can use integers, strings, characters, and other literals as patterns.
Using | allows you to match multiple values in one case, which is very convenient for handling related values. case 3 | 4 | 5 means matching any one of 3, 4, or 5.
_ is the wildcard pattern, which matches any value. It's typically used as the last branch to handle all other cases, ensuring match exhaustiveness.
Change grade on line 2 to "D" and observe what happens. Then try modifying month to different months and see the season matching.