dmitry.petrov
12/19/2016, 1:39 PMcontinue
is an expression in Kotlin (as well as break
, return
, and throw
).
It's not exactly the same thing as a filtered loop, but allows writing code like
for (x in xs) {
val y = foo(x) ?: continue
if (!condition(x, y)) continue
doStuff(x, y)
}
which feels somewhat more flexible compared to a specialized syntax sugar for filtered loops.