fun f1() {
(1…4).forEach {
if (it == 2) return
print(it)
}
}
fun f2() {
(1…4).forEach(fun(it) { // closure
if (it == 2) return
print(it)
})
}
fun main(args: Array) {
f1()
f2()
}
fun f1() {
(1…4).forEach {
if (it == 2) return
print(it)
}
}
fun f2() {
(1…4).forEach(fun(it) { // closure
if (it == 2) return
print(it)
})
}
fun main(args: Array) {
f1()
f2()
}