Skip to content

Instantly share code, notes, and snippets.

@fgaray
Created May 23, 2013 01:31
Show Gist options
  • Save fgaray/5632198 to your computer and use it in GitHub Desktop.
Save fgaray/5632198 to your computer and use it in GitHub Desktop.
object fizzbuzz{
def main(args: Array[String]){
println(fizzbuzzMap)
}
def fizzbuzzMap: IndexedSeq[String] = {
def fizzbuzz2(x: Int): String = {
if(x % 15 == 0) "FizzBuzz"
else if(x % 3 == 0) "Fizz"
else if(x % 5 == 0) "Buzz"
else x.toString
}
(1 until 100).map(fizzbuzz2)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment