Let us not discuss about the continue statement the break and the continue statement.
I used to alter the flow of a new break terminate the loop when a condition is met.
Whereas continue skips the current iteration so let understand how a continuous statement can be used
in a for loop using an example.
So consider this example.
We have a list B which contained positive and negative numbers and 2.
I did it through this list.
We are using of all the body of the for loop contains the if clause and the if clause checks if any
of the items is a negative number.
If the item is a negative number it does not perform any action on the item IDs.
That means if x is greater than or equal to zero.
In that case we square this number and then print the number so let us execute this piece of code in
Jupiter notebook.
So this is the code that we we're going to execute.
If the number or the item in the list B is negative then we do not perform any action.
We use continue statement the continual statement.
Let us keep doing any action on the item in the list because it does make a condition and it allows
the program to go to the next iteration of the next item in the loop.
So let execute this piece of code.
So as you can see the items which are less than zero are not square.
Only the items which are greater than or equal to zero add squared.
So with the continuous statement when me either through a list using your part statement and we have
put a condition to check if any item in the list is less than zero.
So when we use the continue statement because 3 is greater than 0 it is in the square this number and
this is the output it's going to square to.
This is the output and then minus one is less than zero.
So it keeps this particular iteration and then goes to zero.
And the this is the output Zero One is a positive number.
So it squares this item.
This is the output and then it goes to 4 5.
So using the continue statement if a condition is made we can skip the statement and the body of the
loop for the current iteration and jump to the beginning of the loop for the next time duration if we
use a break statement in the for loop.
Let's see how the output looks like.
This is the list B.
These are the items in the list B we have used a condition to check if any item in the list is less
than zero.
So when we use the break statement the loop goes to the first item in the list.
Squares this number because this is greater than zero.
Next it goes to the second item squared.
This number when it comes to minus one.
This is less than zero the Briggs statement prematurely terminated the loop.
So it does not go to the next item.
It comes out of the for loop.
So this is the difference between the continue statement and daybreak statement.
Next as the parse statement the past statement does nothing.
It can be used when a statement is required syntactically but the program requires no action the past
statement acts as a placeholder.
And it is usually used when there is no need of code but the statement is still required to make a code
syntactically correct so let's see an example so consider an example here.
So I have an if a live else statement here and the if clause checks if the use it has input white.
In that case it it prints out this character next.
The left clause checks if the user has input in that case it prints this correct coming to the else
clause if the user inputs any other character apart from Y or N or if he does not input anything within
a specified time I have used a pass statement which does nothing but makes decode syntactically correct.
We can not leave the body of the else clause empty.
So we are going to use a parse statement here and this brings us to love the topic loop control statement.
Break.
Continue and pass.