Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. let somePoint = (1, 0)
  2.  
  3. switch somePoint {
  4. case (0,0):
  5. print("origin") // does not print
  6. fallthrough
  7. case (_, 0):
  8. print("y-axis") // prints y-axis. this makes sense
  9. fallthrough
  10. case(0, _):
  11. print("x-axis") // prints x-axis (because of fallthrough? this should not print)
  12. fallthrough
  13. case(-2...2, -2...2):
  14. print("in 5x5 box about the origin") // this prints and makes sense
  15. default:
  16. print("somewhere else") // does not print
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement