blob: ec5e7229d30c023243bdf258af60fdee58d3053e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
object Test {
def f(): Int = {
try {
val g = 1 to 10 map { i => return 16 ; i } sum;
g
}
catch { case x: runtime.NonLocalReturnControl[_] =>
println(x.getClass.getName)
x.value.asInstanceOf[Int]
}
}
def main(args: Array[String]): Unit = {
println(f())
}
}
|