hey! is there a way to create an enum class with '...
# announcements
x
hey! is there a way to create an enum class with 'normal' strings?
so instead of having something like
Copy code
enum class test {
  A,
  A_B
}
to be able to have something like
Copy code
enum class test {
  A,
  "A - B"
}
a
Copy code
enum class test {
  A,
  `A - B`
}
x
damn thats awesome, thanks
Enum entry name '`A - B`' may contain only letters, digits or underscores
hmmm
it seems to only be a linting suggestion though
very interesting
o
Why would you want this. How will you access it?
x
in all honestly ill just return the values somewhere
o
You can do:
enum class test (val desc: String){
A("A"), A_B("A - B") } fun main() { println(test.A_B.desc ) }
👆 2