Hey, guys, what's up?
So now we will learn how to alter the flow of a loop so we can do this with the help of big art, with
the help of continue.
So let us Fallston list and.
What is the flow over loop?
So you are having a loop.
You will be having condition here.
Then you will do some work and then this is the ending of loop.
So what happens generally?
First of all, there must be some initialization then if you must be having her condition.
So if this condition is true, you will go inside the loop and you will execute all the instruction
and Venu will reach her.
You will again come upward and you will check the condition.
If the condition is again through, you will again do the work and then you will again check the condition.
OK.
So if the condition is falls, then you will reach here.
So if the condition is falls, then you will reach her, OK.
So this loop.
So this loop will get terminated.
This loop will get terminated.
Venne condition when condition is false.
OK.
So if this condition will become false, you will reach here at this line after after this you will
reach her.
If the condition is false.
OK.
So what do we do in this?
We do.
Let us talk about.
Break.
And next we do.
We will talk about.
Continue.
OK.
So what Blake will do?
So you are having a loop.
OK, here's a condition.
There are so many structures, then you are having brakes, treatment, then some instructions.
So what will happen?
First of all, to check the condition condition is true, OK?
The condition is true.
You will go inside and you will execute all the instruction to execute all the instruction and you reach
at this instruction.
So this is break.
And as the name suggests, it will break the loop.
So as soon as you will execute this instruction, I will reach here.
OK.
So I will reach here as soon as this instruction is executed, loop will be broken.
OK, so we have.
So we have altered the flow of love.
And also, if this brake statement is executed, these instructions will not be executed because I will
reach here directly from here to here.
I will reach here, OK?
It doesn't matter whether the condition is true or false.
So condition doesn't matter if he will hit the brakes statement.
You will reach here.
OK.
So condition doesn't matter.
So, for example, you have a lube.
And here you are having your condition.
Now inside this loop.
You're having one more look.
And similarly, the condition and then you are having some instructions and then there is based treatment.
And then again some instructions and then these other instruction of outlook.
Again, destruction of outer loop.
And this is the ending of outer loop.
OK.
So what will happen if this condition is true?
I will execute these instructions.
And if and when I will reach here, I will execute this instruction.
So I will Lord reach here, OK?
I will not reach here.
I will reach here.
OK, so the inner most the inner most loop will be broken.
OK, so when this big statement will be executed, you will reach here, you will not reach here.
So this is wrong.
You will reach here.
This loop will be broken.
OK.
This loop will be broken.
And also these statements, these instructions will not be executed.
Okay.
Now, if you are having so, for example.
Condition.
Then again, lobe, then again, condition.
Then some instructions.
Then destruction, then break.
Then some instructions.
OK.
So in this case, if this condition is true.
I have this condition as to this loop will get executed first, if the conditions become false, you
will reach at this line, you will execute the instruction, then you will hit the brakes treatment
as soon as you will reach.
Yes.
And as you will hit the big statement, then you will reach her, OK?
Then you will reach at this lane.
OK.
And these instructions will not to be executed.
So we have altered.
The normal flow ofa loop of loop.
OK, so we have altered the normal flow of the loop.
So this is all my big statement works.
So let's see in voguing example.
So I have already made the file.
The name of this file is Brigg Dot CPB.
Now, what I will do, I will write a program and you have to tell me what will be the output of the
program.
OK, so let's get started.
So let's create a variable lie, which is initially, too.
Now let us right away loop.
I am putting some random condition here.
While I less than goes to, let's say, 20.
Now let's say I'm using F again some random condition.
If I let's say Moorgate, if I made it equals equals zero then what do you do.
I will increment the value of I.
Okay.
So otherwise I will print the value of high and low to give spaces.
And incrementally value if I.
Okay.
So I am not using Bayes statement.
So tell me what the output.
I think my output will be.
So if the value of AI is to okay, the value of I used to this condition is false.
I will reach FCL, they will be printed.
I plus press the new value of I use three.
So this condition, again, false.
They will be printed four, five, six, seven.
Now the value of I will become eight.
So it is less than 20.
I will check here it Mordred is zero.
So I Pless press the new value of I is.
Then, well, if I is nine.
Initially it was it.
Now, after I please, Preston, you will if I is nine c0 day so nine will be printed I plus plus.
So anyway if I is ten.
So ten.
Eleven, twelve then again.
Thirteen, fourteen, fifteen.
And when the value of I will become sixteen this condition will again become true.
And the value if I will become a 17.
Then you will print the value of eight or seventeen will get printed and the value of I.
So 18, 19 and 20.
So in this output only.
So from two to twenty two numbers are missing.
And what are those two numbers?
Those two numbers are eight and sixteen.
Okay, so Marlboro will be starting from two till twenty and eight and sixteen should not be there.
So let's see whether that outpoured that I hold in later is correct or not.
So starting from two till 20, no, it is missing.
And similarly, number 16 is missing.
So I have generated the correct output.
Now, let us use brake statement here.
So, for example, let's use a big statement here, I please press, then I'm using vague statement.
So what will happen?
So this condition will become true.
When I will become it.
OK.
So that means two, three, four, five, six, seven.
This will be normal, Brent.
Now I become saved.
Okay.
So I become saved.
I please press the media.
If I become s9 brick no brick statement get executed.
What will happen.
I will reach at line number 17 and then I will execute the program.
Okay.
I will reach line number 17.
Then I will exit your deprogram.
One more time.
What will happen.
So what will happen?
This statement, this condition will only be true when the value of five will become eight or 16.
So two, three, four, five, six and seven will be printed.
Now, the value of high is eight.
So this condition becomes true.
If this condition is true, I will go inside increment value of face with a new way.
If I we become nine, then break statement is getting executed.
So what will break do?
The function of break is to break the loop.
So it will break the loop.
So which is the closest loop.
I think Viall is the only loop.
So this loop will be the closest to the innermost loop.
So this very loop will be broken.
And I will reach at the end of the VI looked at this line number 17, and then I will execute the rest
of the instructions.
So I think my output should be this only two, three, four, five, six and seven.
So let's see where they have generated the correct output or not.
So two, three, four, five, six and seven is the output.
OK.
So the functionality of the break is to break loops and which loop in their most loop.
OK.
So that is it for this video.
If you have any doubt, feel free to ask.
Thank you.