For loop is probably the most popular looping instruction.
The for allows us to specify three things about a loop in a single line:
- Setting a loop counter to an initial value.
- Testing the loop counter to determine whether its value has reached the number of repetitions desired.
- Increasing the value of loop counter each time the program segment within the loop has been executed.
In General the for loop syntax is :
for (initialize counter; test counter ; increment counter )
perform the task;
- 60The keyword continue allows us to take up the control to the beginning of the loop, bypassing the statements inside the loop, which have not yet been executed. When continue is encountered inside any loop, control automatically passes to the beginning of the loop. A continue is usually associated with an…