Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanchosaravia/a063c99fb06dda9b2ef9 to your computer and use it in GitHub Desktop.
Save juanchosaravia/a063c99fb06dda9b2ef9 to your computer and use it in GitHub Desktop.
for n in 0...100 {
var msg = ""
switch(n) {
case 30...40:
msg = "Viva Swift!!!"
case let (x) where (x%5 == 0):
msg = "Bingo!!!"
case let (x) where (x%2 == 0):
msg = "par!!!"
case let (x) where (x%2 == 1):
msg = "impar!!!"
default:
msg = "empty"
}
print("#\(n) \(msg)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment