Skip to content

Instantly share code, notes, and snippets.

@gpaulbr
Last active March 21, 2018 01:27
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 gpaulbr/d256094b2fc32b36cdd71033b094d979 to your computer and use it in GitHub Desktop.
Save gpaulbr/d256094b2fc32b36cdd71033b094d979 to your computer and use it in GitHub Desktop.
https://try.kotlinlang.org/#/Examples/Basic%20syntax%20walk-through/Use%20when/Use%20when.kt
https://try.kotlinlang.org/#/Examples/Basic%20syntax%20walk-through/Use%20when/Use%20when.kt
http://www.99-bottles-of-beer.net/language-kotlin-2901.html
when (obj) {
1 -> println("One")
"Hello" -> println("Greeting")
is Long -> println("Long")
!is String -> println("Not a string")
else -> println("Unknown")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment