Pattern matching inspects a value’s structure more deeply than a boolean test. It can test enum variants or tuple positions and bind matched pieces to names.
The demo sends Some(7) past the None arm and into Some(n), where n becomes 7. Covering all variants helps expose missing handling when the model grows.
When to use
Use it to handle option, result, or state variants explicitly.