Enums have supporting functions like valueOf, values or enumValues what makes them easier to iterate over or serialize. Just like classes, they can have custom methods or hold data, but always one per enum value. They are perfect to represent a set of constant values. Sealed classes can hold data specific to an instance. They are perfect to represent messages or classes with a concrete set of subclasses.

#sealed-classes #enum #kotlin

Enum vs Sealed class — which one to choose?
12.50 GEEK