break terminates the execution of the loop immediately and the control passes to the next statement following the loop.
continue starts a new round in the loop (jumps to the closing brace of the loop body)
The statements effect only the innermost loop they are executed in.
The flow of the events in different loops:
Fig: The while loop
Fig: The do-while loop
Fig: The for loop
No comments:
Post a Comment