Skip to content

Instantly share code, notes, and snippets.

@k4zy
Created June 5, 2014 12:42
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 k4zy/0b0ad0fdd7d9ccca9d65 to your computer and use it in GitHub Desktop.
Save k4zy/0b0ad0fdd7d9ccca9d65 to your computer and use it in GitHub Desktop.
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