Hey guys, is there any way in a forEach (on a Map)...
# getting-started
a
Hey guys, is there any way in a forEach (on a Map) to skip to the execution of the next element? Akin to Java's "continue" keyword in loops...
w
akperkins1: In Java (or JavaScript), that would be a
return
, so your lambda would just move on to next item…
OK, now (after reading more about Kotlin) can see that
return
in lambda would just exit from an enclosing scope. See: https://blog.jooq.org/2016/02/22/a-very-peculiar-but-possibly-cunning-kotlin-language-feature/
k
you can do
return@forEach
👍 2
a
sweet! thanks @kirillrakhman and @witoldsz !!