Can we break the `forEachIndexed` loop in Kotlin? ...
# announcements
k
Can we break the
forEachIndexed
loop in Kotlin? While iterating the array, I want to break it based on a specific condition is met. I have tried
break
but getting compile time error break and continue are only allowed inside a loop. Using
return
just skips that specific index but continues the loop. Does it mean we cannot
break
forEach
or
forEachIndexed
?