Saturday, 6 February 2016

How cursor move in "For Loop"?

How cursor move in "For Loop"?


For Loop execute specific Line/area  again and again, until the certain condition not false.

 The syntax of a for loop is:

 for(initialization; condition; increment/decrement)

for(i=0; i<=10; i++)
{
    Print i;
}


Step by Step For Loop Process


1. Cursor initialize the value i=1;
2. then check the condition (if i<=10) 
3. if condition is true (means i<=10) then , cursor execute next line.
4. after that go to  increment/decrement,
5. in step five, again check condition (if i<=10), means again step 2 until condition (if i<=10) not flase.
6. if condition (if i<=10) flase, cursor jump out the loop.



Flowchart of for loop


No comments:

Post a Comment