mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 00:21:26 +00:00
27 lines
469 B
Kotlin
Vendored
27 lines
469 B
Kotlin
Vendored
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
|