Let's say I have an enum Color containing the possible color-values for my program: red, blue and orange. And then I would like to add methods that work on those colors. How can I add those methods in Scala?
enum Color {
case Red
case Blue
case Orange
}
I'm using Scala version 3.
I tried making a class that takes as parameter a value of the enum type Color, and contains the methods needed for the enum. I do however think that there is a better way to handle this case.