Advertisement
Larme

Switch order

Mar 30th, 2020
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.28 KB | None | 0 0
  1. let value: Int = 6
  2.  
  3. switch value {
  4. case 1...6:
  5.     print("1...6")
  6. case 6...8:
  7.     print("6...8")
  8. default:
  9.     print("other")
  10. }
  11.  
  12. switch value {
  13. case 6...8:
  14.     print("6...8")
  15. case 1...6:
  16.     print("1...6")
  17. default:
  18.     print("other")
  19. }
  20.  
  21. //Output:
  22. //$>1...6
  23. //$>6...8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement