Created
May 23, 2013 01:31
-
-
Save fgaray/5632198 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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