I want to use inline function return outside function(skip print the "after"). So when I use
inline fun test() {
return
}
fun test1() {
println("before")
test()
println("after")
}
test1()
the output is
before
after
When I use
inline fun test(callBack: () -> Unit) {
callBack()
}
fun test1() {
println("before")
test {
return
}
println("after")
}
test1()
the output is
before
So I want to know why the return statement in the first inline function is not working. Why does the first block of code not work?