Suggest an editImprove this articleRefine the answer for “The continue keyword”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**`continue`** is a keyword that skips the rest of the current loop iteration and moves on to the next one. **Key point:** unlike `break`, which stops the loop entirely, `continue` only skips a step and keeps the loop running.Shown above the full answer for quick recall.Answer (EN)ImageThe `continue` keyword is used inside loops and means: > *"skip the rest of the current iteration and move on to the next one"*. That is, the loop **does not stop completely** (as with `break`), it simply **moves on to the next step**. --- ## Example with `for` ```javascript for (let i = 1; i <= 5; i++) { if (i === 3) continue; // skip 3 console.log(i); } ``` Result: ```javascript 1 2 4 5 ``` What happened: - At `i = 3`, `continue` fired - JS skipped `console.log(i)` and **jumped straight to the next iteration** (`i = 4`). --- ## Example with `while` ```javascript let i = 0; while (i < 5) { i++; if (i === 3) continue; console.log(i); } ``` Result: ```javascript 1 2 4 5 ``` > As soon as `i === 3`, the `continue` statement skips `console.log(i)`, > and the loop returns to checking the condition `i < 5`. --- ## The difference between `break` and `continue` | Keyword | What it does | |---|---| | `break` | Stops the loop completely | | `continue` | Skips the rest of the loop body and moves on to the next iteration | Example: ```javascript for (let i = 1; i <= 5; i++) { if (i === 3) continue; // skip 3 if (i === 5) break; // stop the loop console.log(i); } ``` Result: ```javascript 1 2 4 ``` --- ## Example with a condition ```javascript for (let i = 1; i <= 10; i++) { if (i % 2 === 0) continue; // skip even numbers console.log(i); } ``` Result: ```javascript 1 3 5 7 9 ``` > Convenient when you need to act **only on certain elements**. --- ## Example with nested loops `continue` can be used with a **label**, if you need to move on to the next iteration of the **outer** loop. ```javascript outer: for (let i = 1; i <= 3; i++) { for (let j = 1; j <= 3; j++) { if (j === 2) continue outer; // skip the remaining steps of the inner loop console.log(`i=${i}, j=${j}`); } } ``` Result: ```javascript i=1, j=1 i=2, j=1 i=3, j=1 ``` --- ## Summary | Keyword | Behavior | |---|---| | `continue` | Skips the remaining code of the iteration and moves to the next one | | Where it is used | Only in loops (`for`, `while`, `do...while`, `for...of`, `for...in`) | | Difference from `break` | `break` stops the loop completely | --- ## In short - `continue` means **"move on to the next iteration"**. - It skips the remaining code in the current loop. - It is convenient when you need to "filter" iterations by a condition, without stopping the loop completely.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.