Skip to content

Instantly share code, notes, and snippets.

@Biacco42
Last active August 21, 2017 15:29
Show Gist options
  • Save Biacco42/74796117c2015d1d8ec74dcadd48643a to your computer and use it in GitHub Desktop.
Save Biacco42/74796117c2015d1d8ec74dcadd48643a to your computer and use it in GitHub Desktop.
object FizzBuzz {
def main(args: Array[String]) {
val fizzbuzz = (1 to 100).map { i =>
(i % 3, i % 5) match {
case (0, 0) => "fizzbuzz"
case (0, _) => "fizz"
case (_, 0) => "buzz"
case _ => i.toString
}
}
fizzbuzz.foreach { println }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment