A labeled return is return@..., where ... indicates the "label" of the scope of the return.

For a return in a lambda expression, you can use the name of the function that invoked the lambda expression as the label (e.g., return@forEach). This sets the lambda expression itself as the scope, and return will only return from the lambda expression, not from the entire function that contains the lambda expression.

Run Edit