trpl-zh-cn/listings/ch19-patterns-and-matching/no-listing-02-multiple-patterns/src/main.rs

12 lines
202 B
Rust
Raw Normal View History

2022-02-06 16:43:51 +08:00
fn main() {
// ANCHOR: here
let x = 1;
match x {
1 | 2 => println!("one or two"),
3 => println!("three"),
_ => println!("anything"),
}
// ANCHOR_END: here
}