Let us proceed and check out how do we use do while loop in Gears of Cartland.
Now the syntax of doing a loop in case of Gorlin is similar to darte of Java.
So here this is our cantor very well and I.
So now after this I will simply define do while loop.
Now insert this.
I will simply print.
Let's see the value of i.
And then I was simply increment the Gounder.
I blissfulness.
Now the question arises where we're actually doing the condition check.
Now in case of do loop we actually do the conditions at the end.
So here I was simply write a while and then I will do the condition check.
Let's see it is smaller than 10 right.
Or I is more than equal to 10.
And now let us run the called.
So the output again we get 1 to 10 right and now again if I ask you to print all the even numbers with
the help of Dubai Velu present between 1 and then so far that again inside there do very low body.
I was interviewed Read the if condition if I Martinus to is equal to equal to zero then only bring the
value that is put into print only that even numbers.
And now let's just read the code.
So here we go to 4 6 8 and 10.
So the syntax is almost same as that of any other programming language as part of C C++ and act of Java.
So this is all for this video.
And again if you are a beginner and want to know how the do while loop actually works then please continue
watching this video.
So here this is a syntax of their do value here.
The first initialize the counter and then the right does Sendak's do vile condition.
Now insert there do we have a body there we actually put our code and then in agreement or decrement
the counter and same way on the left hand side I have some example for you.
So here I will simply print hello three times and here we will check out how they do value simply put
in.
Hello three times in the output console.
So as usual the output we are getting three times.
So at least three times the loop will be executed.
So let us check out the sequence of operations such as in Gears of W.
The first execute the called then increment the counter and then check the condition right.
So this is the sequence of ne'er do well you know then the loop one starts the call executes that is
we get hello in the output.
So we simply print hello and then Ingram and the counter and then the counter variable becomes one and
then finally check the condition which becomes true.
Now make a note here.
We are checking the condition at the end.
So no matter if the condition is true or false.
At least we will execute our called body at least once.
So once the condition becomes true and it becomes one then this equal to 1 simply comes our this loop
to wait again.
We put in the value as hello and then increment the counter to do.
And then again check that our nation are at the end which again becomes true.
Now here the counter value becomes two.
Now this going of value again comes in that third loop where we first put in the value.
And again Ingram and the counter to three.
Now this time this tree is actually not smaller than three.
So the condition here becomes far as but please note is that since the condition is false.
But before checking the condition we have simply printed Hello.
Right here.
Print Hello.
So at the end of third loop if the condition becomes false.
It doesn't matter because we have already printed hello in the output.
So once it becomes three this by two in is shared the for loop but this does NOT happens because the
condition is false and the loop terminates.
So this is how their due value works in case of Cartland.