A for loop follow this syntax:
for(initialization; termination; increment)
Consider an example that runs 5 times. Each time the loop runs is called one iteration of the loop.
for(int i = 0; i < 5; i++)
In the example above, the for loop consists of three parts:
Initializing a loop variable i starts at 0
Setting a condition for the loop to continue goes while i < 5
Incrementing the loop variable i goes up by 1 each time
Note: Programmers often use the letter “i” for loops, but this is just a convention. Unlike your other variables (which should have clear, descriptive names) a loop variable should only be a single letter. This is because they’re so common, and only exist for a short time, that it rarely becomes confusing.