E4111

E4111#

The usage of break statement is invalid.

This error happens when you use a break statement in the initialization, condition, or update statement of a loop.

错误示例#

pub fn f(x: Int, y: Int) -> Unit {
  for i = 0; i < x; i = i + 1 {
    for j = { break }; j < y; j = j + 1 {
//            ^^^^^ Error: The usage of break statement is invalid.
        println(i + j)
    }
  }
}

建议#

Do not write break statement in the initialization, condition, or update statement of a loop.