src/content/docs/linter/rules/no-continue.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> :::caution This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time. ::: ## Summary - Rule available since: `v2.3.4` - Diagnostic Category: [`lint/nursery/noContinue`](/reference/diagnostics#diagnostic-category) - This rule doesn't have a fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - Sources: - Same as [`no-continue`](https://eslint.org/docs/latest/rules/no-continue){
"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;
}
let sum = 0,
i;
for(i = 0; i < 10; i++) {
if(i < 5) {
sum += i;
}
}