January 2018
Intermediate to advanced
434 pages
14h 1m
English
Enums are used when a variable can only take one of a small set of possible values. An example would be the case of type constants (direction: "North", "South", "East", and “West”). With the help of enums, you can avoid errors from passing in invalid constants, and you also document which values are acceptable for use.
In this recipe, we will see how to use enums in Kotlin.
Read now
Unlock full access