Kotlin/kotlin-style-guide

Non-local returns

yole opened this issue · 1 comments

yole commented

Avoid using multiple labeled returns in a lambda. Consider restructuring the lambda so that it will have a single exit point. If that's not possible or not clear enough, convert the lambda into an anonymous function.

Do not use a labeled return for the last statement in a lambda:

//Bad
CachedThreadPool.submit { return@submit 239 }