match
Choosing what to do by comparing a value against patterns.
A match expression compares a value against arms' patterns in order and evaluates the first arm that matches.
Examples
let part = match hour { 0..=5 => "night", 12 | 13 => "lunchtime", _ => "other" };picks a word for the hour,lunchtimefor 12.
See also