Created
December 15, 2018 14:28
-
-
Save Hadevs/550ae1db5fd88a6bcb9ed7a61b28a901 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. | |
enum Animal { | |
case cat | |
case dog | |
case foo | |
case bar | |
} | |
let count = 10 | |
let animal = Animal.cat | |
switch animal { | |
case .cat: | |
print("I am kitty cat") | |
case .cat where count < 5: | |
print("I am kitty cat with count less than 5") | |
default: break | |
} | |
// 2. | |
for i in 0..<count where animal == .cat { | |
print(animal, i) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment