MΓ³dulo 02 Β· Kotlin, One Level Deeper β LecciΓ³n 3 de 5 Β· ~12 min
Enums & Sealed Interfaces: A Fixed Set of Choices
A fixed set of choices
A PawWalk user is an owner or a walker. Not both, not "ownerr" with a typo, not some surprise third thing. When a value can only be one of a known, fixed set of choices, Kotlin gives you the enum class.
You declare the choices as entries. A value of the type is exactly one entry: val status = BookingStatus.PENDING.