mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 00:21:32 +00:00
12 lines
210 B
Kotlin
Vendored
12 lines
210 B
Kotlin
Vendored
sealed class Season {
|
|
object Warm: Season()
|
|
object Cold: Season()
|
|
}
|
|
|
|
fun foo(): Season = Season.Warm
|
|
|
|
fun box() = when(foo()) {
|
|
Season.Warm -> "OK"
|
|
Season.Cold -> "Fail: Cold, should be Warm"
|
|
}
|