Enum Classes
enum class lists constants that can have properties and methods.
Example
enum class Level(val code: Int) { LOW(1), MID(5), HIGH(9) }
println(Level.MID.code)
println(Level.values().map { it.name })
println(Level.valueOf("HIGH"))Exercise
Enum keyword.
enum Level
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.