Continue Statement

1 minutes
Share the link to this page
Copied
  Completed
The continue statement is used inside loops. When a continue statement is encountered inside a loop, control jumps to the beginning of the loop for next iteration, skipping the execution of statements inside the body of loop for the current iteration.

Transcript

Hello, in this video I am going to show you the continue statement. So, if you haven't watched the break statement video or you're not don't know where a break statement is, I highly recommend that you check out the previous video which covered break statement basically means it allows you to exit out of the loop and you know, prematurely before the actual full, you know, set of conditions and all this incrementation has completed, okay, so what you can do is something called a continuous statement. And a continuous them just look like that. That's the word continue then a semicolon. And all this does is say, Okay, once it hits the continue, it ignores the rest of the code in that path. But you'll just go back and you'll still do this and of loops or of change knowing this increment in this case, and then you'll continue you know, doing the loop and if it's Never continue to ignore the rest of the path and then just go back to the top.

So instead of me doing 01234, which is what the break statement would have done, it does 0123456789 and five escape because when the selection menu which it always is, and dollar i equals five, then they continue is triggered, which means the rest of the code in there is skipped, and it goes back or is incremented to now six. And as you can see, still within the condition this condition never met therefore continue will never run again. And that's really all there is to the continue statement, the break and the continue statement, go hand in hand. If you have any questions, feel free to pop me a message and as usual, I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.