Skip to content

Instantly share code, notes, and snippets.

@nsfyn55
Created October 4, 2012 22:06
Show Gist options
  • Save nsfyn55/3836778 to your computer and use it in GitHub Desktop.
Save nsfyn55/3836778 to your computer and use it in GitHub Desktop.
Fizzbuzz
object FizzBuzzClient{
def main(args: Array[String]){
val fizzbuzz = for(i <- (_:Range)) yield {
i match {
case i if(i % 15 == 0) => "fizzbuzz"
case i if(i % 3 == 0) => "fizz"
case i if(i % 5 == 0) => "buzz"
case i if(i % 7 == 0) => "bazz"
case _ => i
}
}
fizzbuzz(1 to 100) foreach (println _ )
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment