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