Unpacking Values from Strings and Tuples

Pattern matching is useful for extracting parts of values to variables in a process called destructuring. It’s the primary tool to get part of a string, an item from a list, and a value from the map. We use destructuring together with pattern matching when we’re making two things match. This section will explore pattern matching with several data types and see how we can extract values and make more complex matches.

Matching parts of a string

Get hands-on with 1200+ tech skills courses.