Welcome to the loops chapter.
In this chapter, we're going to look at the different types of loops that there are.
At least we're going to look at the three ones that we are ready for.
And the fourth one we are going to look at in the next chapter, because we first need to understand
how arrays work.
But let's get an overview of what type of loops there are.
And then we're going to go into them one by one, have an exercise for each of them and so forth.
Okay.
So the loop types that there are is the for loop, the while loop, the do while loop and the for each
loop.
And each of them have their own situations where they are used and where they are the most useful.
Some of them can be used for different occasions, so not just in one particular case, but in multiple
cases.
But that's something we will see over time.
I would say.
Let's start with the for loop.
And the syntax for the for loop is the following.
So you have the for keyword.
And then inside of brackets you need a counter variable.
So int I is usually the name for it.
The name I is the common used name for counter variables inside of coding.
Then you use the semicolon.
Really important.
Then in the second spot you have the condition.
So as long as this condition is met, this code here will be executed.
Then you have another semicolon.
And then you need to make sure that there is somehow a way how the condition will not be met anymore.
So you need to bring it closer to where the condition is not met anymore.
And that is in this case done by incrementing I each time.
So we're saying execute this code block as long as I is less than ten.
But each time you run the code increase I by one.
So we start at zero and then we increment each time by one.
So let's have a look at how this looks in Visual Studio in the next video.