-
-
Save masters3d/ea46978ad769fc82e25f 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
func fizzbuzz(i: Int) -> String { | |
let result = (i % 3, i % 5) | |
switch result { | |
case (0, _): | |
return "Fizz" | |
case (_, 0): | |
return "Buzz" | |
case (0, 0): | |
return "FizzBuzz" | |
default: | |
return "\(i)" | |
} | |
} | |
for number in 1...100 { | |
println(fizzbuzz(number)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment