Rust theorytheory 0/50 · 0%
Types · easy

13. Pattern Matching

match, if let and while let.

`match` compares a value against patterns, binding parts of it. Guards add conditions with `if`, `_` is the catch-all, and `@` binds while testing. `if let` and `while let` are concise forms when only one pattern matters.

Check your understanding

  1. 1. Which pattern matches anything?

  2. 2. `if let` is shorthand for…