Using break in the loop, continue or return

break: This statement causes the program to terminate loop that contains it, and the next phase of the program (the entire back of the loop), that is, not jump to the next cycle but to exit the loop. If the break statement is contained in a nested loop, it is only out of the innermost loop.

continue: when there are loop this statement, this statement when the program is running, do not continue to perform loop in the back of the statement but skip to the next cycle at the entrance to execute a loop.

return: is a return from the called function to the calling function to continue, may be provided with a return value, the return specified by the following parameters returned. After the return function is over, the latter statement is not executed

Guess you like

Origin www.cnblogs.com/looner/p/11720884.html