Kotlin’s crossinline keyword
Problem: non-local return Let’s first understand the problem of non-local return with a simple example: fun doSomething() { println(“Before lambda”) doSomethingElse { println(“Inside lambda”) return // This is non-local return } println(“After lambda”) } inline fun doSomethingElse(lambda: () -> Unit) { println(“Do something else”) lambda() } Non-local return In the code above, the return statement … Read more