mirror of
https://github.com/google/comprehensive-rust.git
synced 2024-12-15 14:27:50 +02:00
12 lines
373 B
Rust
12 lines
373 B
Rust
#[rustfmt::skip]
|
|
fn main() {
|
|
let pair = (2, -2);
|
|
println!("Tell me about {pair:?}");
|
|
match pair {
|
|
(x, y) if x == y => println!("These are twins"),
|
|
(x, y) if x + y == 0 => println!("Antimatter, kaboom!"),
|
|
(x, _) if x % 2 == 1 => println!("The first one is odd"),
|
|
_ => println!("No correlation..."),
|
|
}
|
|
}
|