Created
June 5, 2014 12:42
-
-
Save k4zy/0b0ad0fdd7d9ccca9d65 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
extension Int { | |
var fizzbuzz: String { | |
var stuff = (self%3==0, self%5==0) | |
switch stuff { | |
case (true,false): | |
return "fizz" | |
case (false,true): | |
return "buzz" | |
case(true,true): | |
return "fizzbuzz" | |
default: | |
return String(self) | |
} | |
} | |
} | |
for i in 0..50 { | |
println(i.fizzbuzz) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment