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"
|
|
}
|