Conditional loops.
In the previous section we gave a controversial example where the condition in the for loop pulled from
the data.
In this example there is a no live variable used in this condition.
This is then candidate for the wild conditional loop here.
So while here.
Okay, let's make it like that.
My data.
Pull my data and make it true.
Here and while my data here then integer e here my data or we can make it into years bull E here my
data and STD.
S, t d or c out uh, e here and and line here.
As you can see, it created and printed a bunch of ones here.
So this means true here.
The statement will continue to loop until the expiration has a value of false here.
So as with four, you can exit the while loop with prick return true or go to keywords and you can indicate
that the next loop should be executed using the continue statement.
So the first time the var statement is called the condition test before the loop is executed.
In some cases you may want to you may want a loop as good at least once and then test the condition
so much like it depended upon the action in the loop to see if the loop should be repeated.
The way to do this is to use the while loop here.
So now let's make it my data.
False.
Pulse.
As you can see, we printed nothing.
But if we do the do while loop, for example, do do here.
Uh, okay.
Is C out E here or my data here?
And learn.
And.
We're going to add while here while my data.
Here, as you can see here.
So let's print it out.
As you can see here, it printed zero because the vita du while loop, the du conditioning du court
here has to be executed at least once.
So this executes.
And when when our code tries to find that if my data is true or false, it returns the false.
And that's why it printed only once here.
But in this case it printed no, nothing here.
So the, uh, here semicolon after this is required here, this is the class.
So, uh, as you can see here, this loop printed, uh, once here, false.
Uh, despite of my data having false here.
So the difference between two types of loop is that the condition here, the condition is tested before
the loop is executed in the while loop.
And so the loop may not be executed in a DU while loop.
Here the condition is called after the loop, which means that with a do while loop, the loop statements
are always called at once.