‫Welcome back.
‫Now, up until now, we saw the break.
‫Key word that we can use to break out of a loop.
‫And you see here that we're able to loop with a for loop, but with a while loop.
‫As soon as we break, we're done.
‫We've just well broken out of the loop.
‫But could we do that in a for loop?
‫Let's find out.
‫Yep.
‫Brick keyword works in a for loop as well.
‫But there's actually two other things that we can use besides break.
‫One.
‫It's called continue.
‫And you can see here again, blue highlighting if I do continue here and I click run.
‫There you go.
‫We get our looping again.
‫But you're thinking, why?
‫Why do we need this?
‫Like it seems completely useless, right?
‫Well, a break.
‫When we use the break statement, it breaks out of the current and closing loop.
‫So when we used a break statement, we broke out of this loop, right?
‫This whole wall loop, we just exited it.
‫And same with the for loop.
‫We completely exited it.
‫However, with a continue, what we're saying is, hey, whatever happens when you hit this line, continue
‫onto the top of the enclosing loop.
‫So the current closing loop, what is it?
‫It's this for loop.
‫So it's going to go back to the for loop so that if I do something like print here.
‫So that we get it printed twice or you know what?
‫Let's just move print.
‫Down here.
‫Like that.
‫And then same here we're going to just print at the bottom after continue.
‫If I click run.
‫Nothing gets printed because as soon as it sees continue, it's going to say, Och, I'm going to go
‫back to the loop and it's going to keep going, keep going, keep going until, well, the loop ends
‫so that we never actually hit line ten and line four.
‫So that becomes really useful and conditional logic as well.
‫Finally, the third one is called Pass and pass is well, not very useful.
‫It essentially does nothing.
‫If I click run here.
‫And again, it shows me here, line ten, something's wrong.
‫Well, we have to move print up to the top so that while we don't get my list of index of three, which
‫doesn't exist.
‫So again, going back here, if I click Run.
‫Pass doesn't do absolutely anything.
‫It just essentially passes to the next line.
‫So why is that ever useful?
‫It's very rare that you'll see pass in your code, but pass is a good way to have, let's say, a placeholder
‫while you're coding.
‫For example, you want to loop through the for loop, but we don't know what we want to do yet in the
‫code.
‫Let's say that here we're still thinking about it.
‫If I do this and I click Run.
‫I get an error here because.
‫Whoa, whoa, whoa.
‫Expected and indented block because now the for loop or the python interpreters looking for the next
‫like what am I supposed to do with the loop I'm trying to loop and there's no code for me.
‫So you can add a pass here to at least fill something for the for loop to say, Hey, I'm thinking about
‫it, I'm just going to pass it for now, just so you have something so you don't bug me and I'll come
‫back to it.
‫So if I click Run.
‫That still works.
‫So Pass is one of those placeholders that we can use so that there is a line of code that does absolutely
‫nothing that we can still pass through.
‫Again, a very rare thing to see in production code, but while you're developing some developers like
‫using pass and there you have it break, continue and pass I'll see in the next one.
‫Bye by.