The for loop is an entry controlled loop. The for loop has 3
parts, first is initialization, second is conditional, and the third is
increment or decrement part.
In initialization part we decide the starting point of the
for loop, this is achieved by assign a value to a loop control variable. The
second part is condition test part, in which conditions are tested and these conditions
decide the execution of the body of for loop. If conditions are true than the
body of the for loop is executed and execution will jump at third part of the
for loop for increment or decrement in loop control variable. After increment
or decrement in loop control variable conditions are rechecked and this process
is repeated until the conditions become false. All three parts are separated
with semicolon.
Sy:
for ( initialization; condition ; increment or decrement)
{
………………..
…………………..
}
No comments:
Post a Comment