Hey folks, question, how should I go about initial...
# getting-started
j
Hey folks, question, how should I go about initializing an enum from say, a String? The code snippet below is from the official documentation, but I don’t really understand how to actually initialize it since I cannot invoke the constructor of my enum class.
Copy code
enum class Color(val rgb: Int) {
        RED(0xFF0000),
        GREEN(0x00FF00),
        BLUE(0x0000FF)
}
So, how would I go about if I wanted to do something like this:
Copy code
enum class foo(val transactionType: String) {
        BILL("Bill"), TOP_UP("TopUp");
}

init {
   val enumFoo = foo("Bill")
}