Hi, I am trying to do the sample from website,
http://kotlinlang.org/docs/reference/returns.html#return-at-labels
/**
* For loop iterates through anything that provides an iterator.
* See
http://kotlinlang.org/docs/reference/control-flow.html#for-loops
*/
fun main(args: Array<String>) {
returnfromlambdafunction2()
}
fun returnfromlambdafunction2() {
val ints3 = IntArray(10, { it })
println("start lambda")
ints3.forEach lambda@{
if (it == 6) {
println("satisfy 2")
return@lambda
}
println(it)
}
println("end lambda")
}
Expected Result: It should not print after 5
Actual Result
start lambda
0
1
2
3
4
5
satisfy 2
7
8
9
end lambda
it is printing the values after 6
Yours idea wil be much helpful and appreciated