⛔ error:
unlabeled 'break' is only allowed inside a loop or switch, a labeled break is required to exit an if or do. ( 👉 see: for...in vs. forEach )
replit:
(1...10).forEach { n in
if n > 2 { break } // ⭐ `break` is inside a "closure"
// ^^^^^
// ⛔ error:
// • unlabeled 'break' is only allowed inside a loop or switch
// • labeled 'break' is required to exit an `if` or `do`
}