Skip to playerSkip to main contentSkip to footer
  • 5/20/2025
The keywords continue, pass, and break serve distinct purposes in controlling the flow of loops and conditional statements in Python.
Continue: When encountered within a loop (for or while), the continue statement skips the rest of the current iteration and proceeds to the next iteration.
for i in range(10):
if i % 2 == 0:
continue # Skip even numbers
print(i) # Prints only odd numbers: 1, 3, 5, 7, 9
pass: The pass statement is a null operation; it does nothing. It acts as a placeholder where a statement is syntactically required but no action needs to be performed.

Category

📚
Learning
Transcript
00:00We'll talk about break, continue, and pass.
00:03So, let's start with break.
00:05Break keyword basically loop break.
00:09You can use if, for, while, while.
00:13Where Python can break read, it will exit the loop.
00:19Now, you can see that our code is for example,
00:22when Python is while loop, it will not be equal to the value of 9.
00:34However, if I put break here,
00:39basically, Python will read the loop,
00:42the next will not be, it will exit the loop.
00:45Okay, so I will break here, I will execute the loop.
00:48And this is run the loop.
00:51And then, Python will break the loop.
00:56So, break basically loop break is used.
00:59Where Python will read the loop,
01:02let's say, all the rest of the loop is going to go.
01:08And then, it will not go further.
01:11Let's move on.
01:13However, there is another word, continue.
01:16Continue, continue,
01:18what will happen?
01:19When Python will continue,
01:22it will not go further.
01:24But, loop will break the loop.
01:26It will not go further.
01:27It will start.
01:28Okay?
01:29It means that, in the first condition, return is true,
01:34and the first line is printed.
01:35Now, the next one, it will continue.
01:37Okay, I have to go again at this line.
01:40So, this line is on the top.
01:41Y, it will increase.
01:42So, this line is on the top.
01:43Y, it will increase.
01:44So, this condition is on the top.
01:45So, this condition was on the top.
01:4610 is equal to 1.
01:47Again, this is run.
01:48Execute.
01:49It will be done.
01:50It will be done.
01:51It will be done.
01:52Continue.
01:53Okay.
01:54So, it will go back at the top.
01:55Loop again read.
01:56Run.
01:57And, you will see that this line again and again print.
01:59There is a right word that the union ends.
02:00I have lost.
02:01It will not be done with the nawet solid condition animals.
02:03As you see, it will only 94ingends.
02:04So, this is different.
02:05As you see that, you will see a immigrated loop music stage other.
02:10Now, this style миним thunderstorm damage looks like theWees.
02:14grayer.
02:16Yeah, this style.
02:17There is use the same key word.
02:20When we pass something to pass, we don't have any real or tangible use.
02:27For example, we just use this code so that we don't have any error.
02:31For I in range, this is a for loop.
02:34I will say that you will print 10 to 10.
02:39However, I don't know what to do.
02:45At the moment, I don't know what to do.
02:48But I will use this code, which I will use for for for.
03:03However, that code is not ready yet.
03:07However, I need this for here.
03:13For loop is not ready yet.
03:17For loop is not ready yet.
03:19For loop is not ready yet.
03:21For loop is not ready yet.
03:23Pass.
03:25Now you will be good to go.
03:27You will keep on working.
03:29For loop is not ready yet.
03:33For loop is not ready yet.
03:35For loop is not ready yet.
03:39ìfor loop is not ready yet.
03:42For loop are not ready yet.
03:54So now for loop is not ready yet.
03:56For is the best
03:58While or for
04:00For is the best
04:02It depends on your application
04:04If you want to run a application
04:06Time to run
04:08For is the best
04:10However, if you want to run a application
04:12For a specific condition
04:14For a specific condition
04:16For a specific condition
04:18While is the best
04:20For example
04:22If you want to run a block of code
04:24Run to run
04:26When you want to say yes
04:28When you want to say yes
04:30What will happen?
04:32Basically, while loop is the best
04:34While
04:36Let's say true
04:38While
04:40Let's say true
04:42Let's say
04:44Command
04:46Is the best
04:48Input
04:50Please say yes
04:52If
04:54Command
04:56Is equal to
04:58Sorry
05:00Is equal to equal to
05:01Yes
05:02Then
05:04Then
05:06If
05:08If
05:10If
05:12If
05:14If
05:15If
05:16If
05:17If
05:18If
05:19If
05:20Now you will see, please say yes, but I will say no.
05:26Again, it will be asked for me when I say yes.
05:30Now I don't know how to use it when I say yes.
05:34Because I have no idea of number of times,
05:36I have no idea.
05:39So this is the best application of while loop.
05:42No.
05:44Okay, yes.
05:46Now, because I said yes, I have no idea of loop.
05:50Okay?
05:52This is the application dependent.
05:54You only have one thing.
05:56If you have one application for number of times,
06:00then the for loop is the best.
06:03If you have one application for condition,
06:07then,
06:09then,
06:10then,
06:14then,
06:16that will be the condition.
06:18That will be the condition of you.
06:19Yes,
06:20or no.
06:22Okay.

Recommended