Skip to content

Instantly share code, notes, and snippets.

@tasaquino
Last active March 7, 2018 11:40
Show Gist options
  • Save tasaquino/490b333deb230302ad71590510e7a08e to your computer and use it in GitHub Desktop.
Save tasaquino/490b333deb230302ad71590510e7a08e to your computer and use it in GitHub Desktop.
Kotlin - Combined Constants Enum Example
fun showIsGreatHouse(house: House) =
when (house) {
House.TARGARYEN, House.LANNISTER, House.STARK -> "$house is a great house"
else -> "bla"
}
fun main(args: Array<String>) {
println(showIsGreatHouse(House.LANNISTER))
// LANNISTER is a great house
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment