I am trying to break from 'if' condition within a for loop and getting this error. Below is the code:
var isPresent = false
arrayList.forEach { item in
if item.contains("xyz") {
isPresent = true
break
}
}
I am getting this errorL
Unlabeled
breakis only allowed inside a loop orswitch, a labeledbreakis required to exit anifordo"
Can I not use unlabeled break here?