Kotlin Continue and Break Using ForEach

December 27, 2018
items.forEach { item ->
    
    if (item.name == 'continue')
        return@forEach

    if (item.name == 'break')
        return
}
for (item in items) {

    if (item.name == 'continue')
        continue

    if (item.name == 'break')
        break   
}
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.