Skip to content

Instantly share code, notes, and snippets.

@ryoco
Created January 7, 2012 12:51
Show Gist options
  • Save ryoco/1574676 to your computer and use it in GitHub Desktop.
Save ryoco/1574676 to your computer and use it in GitHub Desktop.
scala practice
object FizzBuzz{
def main(args: Array[String]){
val numbers:List[Int] = 1 to 100 toList
val results:List[String] = numbers.map(s =>
if(s % 15 == 0) "FuzzBuzz"
else if(s % 3 == 0) "Fuzz"
else if(s % 5 == 0) "Buzz"
else s.toString
)
println( results )
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment