Courses /
C++ Introduction
For Loop
The for loop is more complex than the other loops and consists of three parts. Structure of for loop:
- Counter;
- Exit condition;
- Loop expression.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/7f63c627-93d7-4ded-87d4-13689d7576df/Java_Loop_FOR%404x-8.png)
main.cpp
int counter = 0
: iteration counter;counter++
: For each iteration, 1 will be added to thecounter
variable to mark the passage of the loop;counter <= 5
: loop termination condition. The loop will continue if thecounter
variable is less than or equal to 5.
Everything was clear?
Section 4. Chapter 6
Course Content
C++ Introduction
4. Introduction to Program Flow
5. Introduction to Functions
C++ Introduction
For Loop
The for loop is more complex than the other loops and consists of three parts. Structure of for loop:
- Counter;
- Exit condition;
- Loop expression.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/7f63c627-93d7-4ded-87d4-13689d7576df/Java_Loop_FOR%404x-8.png)
main.cpp
int counter = 0
: iteration counter;counter++
: For each iteration, 1 will be added to thecounter
variable to mark the passage of the loop;counter <= 5
: loop termination condition. The loop will continue if thecounter
variable is less than or equal to 5.
Everything was clear?
Section 4. Chapter 6