mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
15 lines
198 B
Kotlin
Vendored
15 lines
198 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"
|
|
}
|