Ir al contenido

noContinue

Esta página aún no está disponible en tu idioma.

biome.json
{
"linter": {
"rules": {
"nursery": {
"noContinue": "error"
}
}
}
}

Disallow continue statements.

The continue statement terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration. When used incorrectly it makes code less testable, less readable and less maintainable. Structured control flow statements such as if should be used instead.

let sum = 0,
i;
for(i = 0; i < 10; i++) {
if(i >= 5) {
continue;
}
sum += i;
}
code-block.js:6:9 lint/nursery/noContinue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected use of continue statement.

4 │ for(i = 0; i < 10; i++) {
5 │ if(i >= 5) {
> 6 │ continue;
^^^^^^^^^
7 │ }
8 │

The continue statement terminates execution of the statements in the current iteration, when used incorrectly it makes code less testable, less readable and less maintainable. Structured control flow statements such as if should be used instead.

let sum = 0,
i;
for(i = 0; i < 10; i++) {
if(i < 5) {
sum += i;
}
}