Join Slack
Powered by
how can I break from a foreach :open_mouth:
# getting-started
o
oday
08/17/2017, 1:26 PM
how can I break from a foreach 😮
e
elizarov
08/17/2017, 1:37 PM
You cannot, but here is a related issue:
https://youtrack.jetbrains.com/issue/KT-1436
o
oday
08/17/2017, 3:26 PM
you can return a label
oday
08/17/2017, 3:26 PM
foreach inner@ return@inner
e
elizarov
08/17/2017, 4:34 PM
@oday
You can just
return@forEach
(there is an implicit label), but it does
continue
, not
break
l
leonardootto
08/19/2017, 3:24 AM
Maybe you can create a method and return the value. I don't like too much but works.
2
Views
Open in Slack
Previous
Next