Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. fn main() {
  2. let pair = (2, -2);
  3. // TODO ^ Try different values for `pair`
  4.  
  5. println!("Tell me about {:?}", pair);
  6. match pair {
  7. (x, y) if x == y => println!("These are twins"),
  8. // The ^ `if condition` part is a guard
  9. (x, y) if x + y == 0 => println!("Antimatter, kaboom!"),
  10. (x, _) if x % 2 == 1 => println!("The first one is odd"),
  11. _ => println!("No correlation..."),
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement