...

/

Break and Continue

Break and Continue

Learn about the usage of break and continue keywords.

Introduction

We can use break or continue inside the loops:

  • break exits the closest loop it is in and continues with the next command,
  • continue skips out from the loop body and jumps back to the condition of the loop.

Example: sum every second element of the numbers array:

Access this course and 1400+ top-rated courses and projects.