79297396

Date: 2024-12-20 13:43:34
Score: 0.5
Natty:
Report link

The way I understand it (in Kotlin at least) is that if you have a function that calls a lambda function and the lambda function has a "return" keyword, it would be liable to be interpreted as wanting to return also from the CALLING function:

So if I called my_lambda() from my_function() and there was a "return" in my_lambda(), the compiler would interpret it as a "return" from my_function() as well.

In Kotlin, you can allow non-local returns to return from the calling function by using the "inline" keyword or prevent them by using the "crossinline" keyword. Further details here.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: user16118981