Continue
What is continue? The difference between continue and break
Video Transcript
00:00We've met break in the last video and in this video. We want to focus on one more type of
00:08Operation we could do it out for a loop for loop or any loop for that matter and that is the continue a continue
00:14contrary to break breaks
00:17Get out of a they leave a loop. They never come back that loop is terminated
00:21On the other hand a continue as the name implies continues the loop, but just skips one loop
00:28Now let's see that in action
00:31At any point where we set our continue it would then skip that loop for that duration
00:37So if I would say you're just for example
00:39Let's say in every scenario where I
00:42divides by three
00:45Without any
00:47Let's say, you know, let's make it a little bit more complicated, right? So we're gonna ask if I
00:56If I
00:57mold of three
01:01Not equal zero basic. I'm saying if the number does not divide by three
01:06and
01:08or
01:11well
01:13Or
01:16The number does not divide by two
01:21Then we're gonna leave as well, it's just a little bit playing around just for our practice
01:25So basically what I'm saying here if our eye
01:27Does not divide by three and does not divide by two then we just want to get out of this loop
01:32We're just going to continue
01:36Which basically means that in this interval our eye is not going to be called now
01:40Let's just run it and see what happens now
01:42Let's put here a little bit more value so we'll be able to see something
01:44So I'm just gonna set it from zero through 40
01:48And we'll see that we're only getting numbers that are divisible both by three and two
01:54Because any number that's not which is basically divisible by six, right?
01:58So any number that is not divisible by the two would not continue
02:03It would basically as soon as this hits it would hit the continue, right?
02:07Because if when zero comes in that actually does divide in and flash
02:12So when one comes in it doesn't then it will continue continue means I'm going to skip all the rest of the loop
02:18Return to the beginning and go on to the next number and and so on and so on until it hits that
02:23Condition until it doesn't hit that condition more accurately and our trace is called out
