I want an enum that holds a variable. Is that poss...
# getting-started
v
I want an enum that holds a variable. Is that possible? (Example: Enum of Male or Female, but with a variable "height" that gets passed in constructor)
v
You can do that, but all male will have the same height and all female will have the same height
If that's not what you want, you are most probably more after sealed classes
👆 1
v
Ah. Thx for the pointer! - I want height to be individual.
v
The sense of an enum is that it is an enumeration, so there is exactly one time "male" and one time "female", so yeah, sealed class is it probably
v
Thx. Seems to be exactly what I need.
v
It's neither good behavior to hijack foreign threads with loosely coupled topics, nor to ping random people just to get an answer. I doubt you are interested in specifically my opinion, especially as I'm also relatively new to Kotlin. Better start a separate thread without ping.