OxL Справочник OxL
РусскийEnglish

error outside-loop

error Стандарт: [§5.6]

break или continue вне цикла.

What it means#

break and continue are valid only inside the body of for, while or loop (§5.6), within the same function. A closure body is a new function and does not inherit the loop.

Example#

oxl✓ проверяется в CI
fn main() {
  let done = true
  if done { break }      // <- outside-loop
}
error
outside-loop

How to fix#

oxl✓ проверяется в CI
fn main() {
  loop {
    let done = true
    if done { break }
  }
}

Move the statement into a loop, or use return to leave the function.

See also#

OxL 1.0.0-beta · Версия документации 1.0.0-beta© OxwaldLink · сгенерировано из Стандарта, исходников std и руководства