Last active
March 6, 2018 22:24
-
-
Save tasaquino/2934a872c73424f2e303de7bddbba394 to your computer and use it in GitHub Desktop.
Kotlin - Enum with constructor 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
enum class House(val words:String) { | |
BARATHEON("Ours Is the Fury"), | |
BOLTON("Our Blades Are Sharp"), | |
LANNISTER("A Lannister Always Pays His Debts"), | |
MARTELL("Unbowed, Unbent, Unbroken"), | |
STARK("Winter Is Coming"), | |
TARGARYEN("Fire and Blood"), | |
TULLY("Family, Duty, Honor"); | |
} | |
fun main(args: Array<String>) { | |
println(House.STARK.words) | |
// Winter Is Coming | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment