Skip to content

Instantly share code, notes, and snippets.

@renaudcerrato
Last active March 9, 2019 06:20
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 renaudcerrato/6541a14af699625bca82be8a3d7eb3f1 to your computer and use it in GitHub Desktop.
Save renaudcerrato/6541a14af699625bca82be8a3d7eb3f1 to your computer and use it in GitHub Desktop.
Kotlin Enum
enum class Direction {
NORTH, SOUTH, WEST, EAST
}
enum class Color(val rgb: Int) {
RED(0xFF0000),
GREEN(0x00FF00),
BLUE(0x0000FF)
}
enum class Currency {
USD,
EUR,
XAU {
override fun isPreciousMetal() = true
}; // mandatory semicolon
open fun isPreciousMetal() = false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment