Skip to content

Instantly share code, notes, and snippets.

@tasaquino
Last active March 6, 2018 22:24
Show Gist options
  • Save tasaquino/2934a872c73424f2e303de7bddbba394 to your computer and use it in GitHub Desktop.
Save tasaquino/2934a872c73424f2e303de7bddbba394 to your computer and use it in GitHub Desktop.
Kotlin - Enum with constructor example
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