break statement and continue statement usage and differences

break statement and continue statement usage and differences

The following is taken from Baidu know and
continue (computer language): HTTPS: //baike.baidu.com/item/continue/3009735#1
BREAK statement:
https://baike.baidu.com/item/break%E8%AF%AD % E5% 8F% A5 / 6655078

1, break: while loop is a permanent break terminates the loop. That is not performed later in the current cycle break statement, directly out of the loop.
2, continue: while loop is used to terminate continue this cycle. I.e. later in the current cycle continue code is not executed, the next entry is determined for the next cycle.

Extended data:
the Continue statement Note:

  1. break if-else can be used directly out of the current cycle.
  2. In the multilayer loop, a break only one jump outward.
    is a skip action continue statement loop statement and the remaining end of the loop to forcibly perform the next cycle.

continue statement only in for, while, do-while loop and the like, often used in conjunction with the if condition used to speed the cycle.

Released two original articles · won praise 0 · Views 69

Guess you like

Origin blog.csdn.net/AYA200117/article/details/104083986