`continue` is an expression in Kotlin (as well as ...
# language-proposals
d
continue
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
Copy code
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.