Skip to content

Instantly share code, notes, and snippets.

@jollyjoester
Last active April 15, 2017 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jollyjoester/533e8e4ee24865140d9ce6bf06510216 to your computer and use it in GitHub Desktop.
Save jollyjoester/533e8e4ee24865140d9ce6bf06510216 to your computer and use it in GitHub Desktop.
fizzbuzz in kotlin
(1..100).map {
when {
it % 15 == 0 -> "fizzbuzz"
it % 3 == 0 -> "fizz"
it % 5 == 0 -> "buzz"
else -> it.toString()
}
}.forEach { println(it) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment