keyword
Rust _: wildcard in a pattern
The underscore token can act as a wildcard pattern that does not introduce a named binding. For example, match can use it to handle every remaining case. Expected output: Other rating Why: The wildcard handles a value not matched by the first arm. Common mistake: The wildcard does not create a variable you can read later. A name such as _rating does create a binding.
Formal Syntax & Structure
rust syntaxrust
let _ = expression;Working Example
Example Snippetrust
fn main() { let rating = 2; match rating { 5 => println!("Excellent"), _ => println!("Other rating"), }}