TIL
if let
17.03.2024I recently read about if let
in rust and thought it was neat. I don’t think it has been something like this in any of the other languages I have worked with that had pattern matching and ADTs.
Instead of
match optionalValue { Some(value) => println!(value) _ => ()}
it is possible to do
if let Some(value) { println!(value)}