Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. enum Example {
  2. One,
  3. Two,
  4. Three
  5. }
  6. fn main() {
  7. let e1 = Example::One;
  8.  
  9. let v1 = match e1 {
  10. Example::One => 1,
  11. Example::Two => 2,
  12. Example::Three => 3,
  13. };
  14.  
  15. let e2 = Example::Three;
  16. let v2 = match e2 {
  17. Example::Two => 2,
  18. _ => 99,
  19. };
  20.  
  21. print!("{} + {} = {}", v1, v2, v1 + v2);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement