Match against a pattern (value, nested object, or predicate)
Match multiple patterns (OR operation)
Add a case that matches a specific value (backward compatibility)
Add a case that matches multiple values (backward compatibility)
Default case - makes match non-exhaustive
Force exhaustive matching (compile-time check for union types)
Get result if matched, throws if no match
Get result wrapped in Option
Match with a guard function (alias for readability)
Pattern matching construct similar to Scala's match expressions. Supports exhaustive matching, nested patterns, and guards.
Example
Example
Example