Skip to content

Instantly share code, notes, and snippets.

@davidallsopp
Last active December 23, 2015 23:48
Show Gist options
  • Save davidallsopp/6711981 to your computer and use it in GitHub Desktop.
Save davidallsopp/6711981 to your computer and use it in GitHub Desktop.
Happy Birthday in Scala - a couple of variations
object birthday {
1 to 4 map { i => "Happy Birthday " + (if (i == 3) "dear Scala" else "to you") } foreach println
(1 to 4).foldLeft("")((r,c) => r + ("\nHappy Birthday " + (if (c == 3) "dear Scala" else "to you")))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment