Guest User

Untitled

a guest
Dec 15th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. // 1.
  2. enum Animal {
  3. case cat
  4. case dog
  5. case foo
  6. case bar
  7. }
  8.  
  9. let count = 10
  10. let animal = Animal.cat
  11. switch animal {
  12. case .cat:
  13. print("I am kitty cat")
  14. case .cat where count < 5:
  15. print("I am kitty cat with count less than 5")
  16. default: break
  17. }
  18.  
  19. // 2.
  20. for i in 0..<count where animal == .cat {
  21. print(animal, i)
  22. }
Add Comment
Please, Sign In to add comment