Last active
March 7, 2018 11:40
-
-
Save tasaquino/490b333deb230302ad71590510e7a08e to your computer and use it in GitHub Desktop.
Kotlin - Combined Constants Enum Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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