Anonymous user
Exceptions/Catch an exception thrown in a nested call: Difference between revisions
Exceptions/Catch an exception thrown in a nested call (view source)
Revision as of 20:43, 18 January 2017
, 7 years ago→{{header|Kotlin}}
(Added Kotlin) |
|||
Line 1,628:
<lang scala>// version 1.0.6
class U0 : Throwable("U0 occurred")
class U1 : Throwable("U1 occurred")
fun foo() {
for (i in 1..2) {
try {
bar(i)
} catch(e: U0) {
println(e.message)
}
}
}
|