continue

차노·2023년 7월 28일
0

JS

목록 보기
36/96

for문에서 continue는 해당 조건을 건너뛰고 반복을 수행한다. 결국 조건을 제외한 입력값이 출력된다.

The continue statement breaks(멈춘다) on iteration (in the loop) if a specified condition occurs, and continues with the next iteration in the loop.
The difference between continue and the break statement, is instead of "jumping out" of a loop, the continue statement "jumps over" one iteration in the loop.

The continue statement terminates execution(실행) of the statement(구문) in the current iteration(반복/자동) of the current or labeled loop, and continues execution of the loop with the next iteration.

3만 건너뛰고 해당 output이 출력된다. 그래서 'out'이 아니라 'over'인 것이다.

Description

In contrast to the break statement, continue does not terminate(종료시키다) the execution(실행) of the loop entirely, but instead:

  • In a while or do...while loop, it jumps back to the condition.
  • In a for...in, for...of, or for await...of loop, it jumps to the next iteration.

Reference

The continue statement is used within loops (such as 'for', 'while', or 'do...while') to skip the current iteration and move on to the next iteration.

This was brought back from chat Gpt

0개의 댓글