Loop Control Instructions
To repeat some parts of the program
Types
for do while
while
for Loop
for(initialisation; condition; updation) {
//do something
}
Special Things
- Increment Operator
- Decrement Operator
- Loop counter can be float
or even character
- Infinite Loop
while Loop
while(condition) {
//do something
}
do while Loop
do {
//do something
} while(condition);
break Statement
exit the loop
continue Statement
skip to next iteration
Nested Loops
for( .. ) {
for( .. ) {
}
}