♦ C++ Loops
♣ About C++ Loops
Looping can be done over certain well-defined conditions or expressions.C++ provides majorly two types of looping While Looping and For Looping, although you can create custom looping by defining functions and classes.
♣ C++ While Loop
While Loop accepts a condition or a expression and iterates until that condition or expression is holding boolean value true.Below is the representation of While Loop Syntax.
Basic Syntax
while (expression) { // code for execution }
Syntax Explanation:
expression: logical expression which evaluates to true or false
♣ C++ For Loop
For loop accepts three statements as arguments.Below is the representation of C++ For Loop Syntax.
Basic Syntax
for (statement_1; statement_2; statement_3) { // code for execution }
Syntax Explanation:
statement_1 : initialization statement statement_2 : constraint statement statement_3 : increment statement