Tuple deconstruction binds a tuple’s elements to separate names or pattern components in one step. It removes positional-access boilerplate and makes the values a function uses explicit. section 5.2.2
Use deconstruction to:
- Discard unwanted elements with `_`, documenting that they are intentionally unused. section 5.2.2
Extract only the values you need
let nameAndAge = "Jane", "Smith", 25 let forename, surname, _ = nameAndAge let makeDoctor (_, surname) = "Dr", surname The first pattern ignores age; the second ignores the forename and returns a title with the surname.
