continue and break
- Continue and Break statements
- Continue statement will terminate the current execution of the loop and start the next iteration.
- Break statement will terminate the execution of the loop and comes out of the loop.
- Continue and Break statements are very important in real life implementation.
- For example, you might run placer or some extraction which is running for like a very long time (say 48 hours) and you do not want to lose your database with all the fixes you can use break and come out of the loop. Another example is if you do not want to execute the timer update on every iteration, but want to execute in every other iteration.
Example 1:
No comments:
Post a Comment