hi Avraham,
below is the example of for loop , while loop, and do while loop.
Synext for for loop:
for(start; end point;increment)
for(i=0;i<10;i++)
here in for loop,
start is the postion from where loop will start,
like i=0;
end point is that where loop has to stop;
i<10;
and increment is the next iteration of the loop.
i++
now while loop;
synatx:
start;
while(end)
{
increment;
}
i=0;
while(i<10)
{
i++;
}
while loop is work like for loop; but diffrence is: in while loop we have start end pont and increment in diffrent position;
do- while loop:
syntax:
start;
do{
increment;
}
end;
do while loop is just opposit to the while loop, in case of do while loop, loop will execult one either condition match or not.
Feb 5, 2010