Files
kotlin-fork/compiler/testData/codegen/box/when/exceptionOnNoMatch.kt
T
2021-09-08 19:56:38 +03:00

16 lines
199 B
Kotlin
Vendored

fun isZero(x: Int) = when(x) {
0 -> true
else -> throw Exception()
}
fun box(): String {
try {
isZero(1)
}
catch (e: Exception) {
return "OK"
}
return "Fail"
}