Rust conditionals
From wikinotes
Pattern Matching
Like a switch statement,
but the compiler ensures the entire valid range of items is checked for.
especially useful for enums.// if num is '1', returns 'a' // if num is >2, returns 'c' let result = match num { 1 => "a", 2 => "b", _ => "c", }