1.

What are the differences between break and continue statement.

Answer»

Break:

  • Break is used to terminate the execution of the loop.
  • It breaks the iteration.
  • When this statement is executed, control will come out from the loop and executes the statement immediate after loop.
  • Break is used with loops as well as switch case.

Continue:

  • Continue is not used to terminate the execution of loop.
  • It skips the iteration.
  • When this statement is executed, it will not come out of the loop but moves/jumps to the next iteration of loop.
  • Continue is only used in loops, it is not used in switch case.


Discussion

No Comment Found