Skip to content

Instantly share code, notes, and snippets.

@greister
Forked from anonymous/playground.rs
Created April 17, 2016 06:31
Show Gist options
  • Save greister/13b84922ad5f9c0baa2134ef2102a947 to your computer and use it in GitHub Desktop.
Save greister/13b84922ad5f9c0baa2134ef2102a947 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
fn main() {
do_stuff((42, 0));
do_stuff((0, 42));
do_stuff((0, 0));
do_stuff((123, 456));
}
fn do_stuff(point: (u32, u32)) {
match point {
(0, 0) => println!("both are 0"),
(left, 0) => println!("right is 0, left = {}", left),
(0, right) => println!("left is 0, right = {}", right),
(left, right) => println!("left = {}, right = {}", left, right)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment