proper compilation of enums
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
enum class State {
|
||||
O
|
||||
K
|
||||
}
|
||||
|
||||
fun box() = "${State.O.name()}${State.K.name()}"
|
||||
@@ -0,0 +1,8 @@
|
||||
enum class State {
|
||||
_0
|
||||
_1
|
||||
_2
|
||||
_3
|
||||
}
|
||||
|
||||
fun box() = if(State._0.ordinal()==0 && State._1.ordinal() == 1 && State._2.ordinal() == 2 && State._3.ordinal() == 3) "OK" else "fail"
|
||||
@@ -0,0 +1,6 @@
|
||||
enum class State {
|
||||
O
|
||||
K
|
||||
}
|
||||
|
||||
fun box() = "${State.O}${State.K}"
|
||||
@@ -0,0 +1,11 @@
|
||||
enum class Color {
|
||||
RED
|
||||
BLUE
|
||||
}
|
||||
|
||||
fun box() = if(
|
||||
Color.valueOf("RED") == Color.RED
|
||||
&& Color.valueOf("BLUE") == Color.BLUE
|
||||
&& Color.values()[0] == Color.RED
|
||||
&& Color.values()[1] == Color.BLUE
|
||||
) "OK" else "fail"
|
||||
Reference in New Issue
Block a user