Last active
March 9, 2019 06:20
-
-
Save renaudcerrato/6541a14af699625bca82be8a3d7eb3f1 to your computer and use it in GitHub Desktop.
Kotlin Enum
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 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