Which programming language is this?
sealed interface Event
data class Click(val x: Int, val y: Int) : Event
object Close : Event
fun handle(e: Event): String = when (e) {
is Click -> "click at ${e.x},${e.y}"
Close -> "closing"
}
Answer: Kotlin
A
Play Programming Languages ▸
sealed interface implemented by a data class and an object, matched exhaustively in when with is, is Kotlin.