What is For Loop?
- For loop is the Entry Control loop It's having 3 parts Initialisation,Condition,Increment/Decrement All 3 parts are optional. you can skip all or anyone according to your need.
- All parts(Initialisation,Condition,Increment/Decrement)
for(initialisation; condition; increment/decrement) { //Loop body Instructions //this is a place where you write a set of statements perform again and again }
- With 2 parts(
Initialisation,Condition,Increment/Decrement)
Initialisation for( ;Condition;Increment/Decrement) { //Loop body Instructions //this is a place where you write a set of statements perform again and again }
- With 2 parts(Initialisation,
Condition,Increment/Decrement)
for( initialisation; ;Increment/Decrement) { //Loop body Instructions // There must be one Break statement otherwise it becomes Infinite (∞) //this is a place where you write set of statements perform again and again }
With 2 parts(Initialisation,Condition,Increment/Decrement)
for( initialisation ;condition;) { //Loop body Instructions //this is place where you write set of statements perform again and again //increment/decrement/some operation with initialised variable otherwise this loop act as Infinite Loop (∞) }
With 2 parts(Initialisation,Condition,Increment/Decrement)
for( ; ; ) { //Loop body Instructions //this is a place where you write a set of statements perform again and again
}
- All parts(Initialisation,Condition,Increment/Decrement)
What is For Loop?
May 18, 2023
0
We you have any doubt let me know :)