Enums in Kotlin

Enums are a great way to enforce type and value safety. Just like in Java, Kotlin also has enums and the following way in which an enum can be defined:

enum class Transaction(var code : Char) {
DEPOSIT('d'),
WITHDRAW('w')
}

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.235.144