So let us talk about law and let us understand what our lupe's.
Now, let's say you have a repetitive task, you could combine this repetitive task and if your lines
instead of writing it 100 times, well, not all repetitive tasks can be solved only by loops, but
a lot of them do.
So let me give you a very, very basic example.
Let's say that you unapparent numbers like you on print numbers between one on three.
You could do the following.
You could say serial print one, serial print, two, three point three, and you would see the numbers
print on your own doing sketch screen.
That's great.
But let's say you're trying to to print a hundred numbers, like let's say you're trying to print numbers
between one and a hundred.
It really does not make sense that you say one, two, three, all the way to 100 and consuming 100
lines.
Well, that's not really efficient.
This is why we use loops like the foil.
So we're going to talk about the full loop right now.
If you do this exactly like that, you're going to print this three times, OK?
You're going to print numbers between one and three within just two lines instead of three.
You could bring the numbers between one on 100 with two lines instead of 100.
So let us analyze this and break it down to see what does it mean.
We said four is the for loop and then we had integer equals one.
Well, we are saying that what we are doing here is defining a counter.
So this counter is going to be counting, starting at a certain value and this counter value is one.
OK, so this is the variables that will be counting and we will give it initial value of OK.
Now the next one is the condition that as long as it is satisfied, we are going to continue doing the
loop.
So in our case, as long as I is less than four, which is as long as the counter is less than four,
I just want to keep going.
So when the counting is one, which is the initial value of giving it, when the counter is still,
when they calculate the three, it's all relevant and the loop will keep running.
But the moment is I equals four.
This will give me an issue because this condition is not satisfied anymore and I should break out of
the loop now, i.e. plus plus is the action.
So in our case, we want to increment this counter by one every time we pass it.
This is the condition that will keep incrementing or maybe diclemente or counter until your condition
is satisfied.
So let us start the tracking.
What's going on?
So the first iteration equals one.
OK, so we are printing serial print, i.e. what is I want.
So we are printing one now.
In the next iteration I will be two.
OK, so we are incrementing.
It is two now is to less than four.
Yes.
So we will jump back here in the second iteration right now and we're going to print I which is do so
the print on the screen.
On the cereal screen we will print two.
OK, and then we will jump back here to the condition and we are going to incremented.
So now I is three because we are incrementing by one I suppose is the same as I equals a plus one so
equals eight plus one.
I still plus one is the three.
OK so now I is three.
So surreal print, I will print three for me and then we will jump back to the next situation and we
will increase by one.
Now I is for is for less than four.
No, that's not correct.
So this condition is not satisfied anymore.
And we are going to break out of this loop and we will not be printing anything.
So what we have printed is one, two, three.
OK, so let me recap.
We have the serial one, two, three.
The way this work is, you initialize the calendar at a certain number.
We put the range that we want to count and lost one.
And then we put this in fermentation and we start printing.
It is as simple as that.