mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
27 lines
466 B
Kotlin
27 lines
466 B
Kotlin
enum class Season {
|
|
WINTER
|
|
SPRING
|
|
SUMMER
|
|
AUTUMN
|
|
}
|
|
|
|
fun foo1(x : Season?) : String {
|
|
when(x) {
|
|
Season.AUTUMN, Season.SPRING -> return "autumn_or_spring";
|
|
Season.SUMMER, null -> return "summer_or_null"
|
|
}
|
|
|
|
return "other"
|
|
}
|
|
|
|
fun foo2(x : Season?) : String {
|
|
when(x) {
|
|
Season.AUTUMN, Season.SPRING -> return "autumn_or_spring";
|
|
Season.SUMMER -> return "summer"
|
|
}
|
|
|
|
return "other"
|
|
}
|
|
|
|
// 2 TABLESWITCH
|