-
-
Save greister/13b84922ad5f9c0baa2134ef2102a947 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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