Track 3 · Lesson 10 of 11
The match statement
Choose between many exact values with match and case, combine options with |, catch everything else with _, and capture unmatched values.
You will be able to
- Write a match statement that compares one value against several literal patterns
- Combine alternatives in one case with |
- Use case _ as the catch-all branch
- Explain why a bare name in a case captures every value, and use that deliberately
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.