Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Kotlin has a notion of function inlining with the return statement being inlined too. This means you can do, e.g.:

list.forEach { if (it == something) return; }

and you aren't returning from the code block, but the enclosing function. Yet behind the scenes forEach is being expanded by the compiler into a regular imperative for loop, in a macro-like way.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: