Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created July 4, 2009 09:43
Show Gist options
  • Save hitode909/140516 to your computer and use it in GitHub Desktop.
Save hitode909/140516 to your computer and use it in GitHub Desktop.
object FizzBuzz {
def fizzbuzz(i:Int) = (i%3==0, i%5==0) match {
case (true,true) => "Fizz Buzz"
case (true,false) => "Fizz"
case (false,true) => "Buzz"
case (false,false) => i
}
def main(args: Array[String]) {
println((1 to 30).map(i => fizzbuzz(i)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment