Re: i need a detailed information on LOOP
> And also give some example with cooding in loops
The for loop described: It repeats a block of statements until a condition you specity is no longer met.
The structure is as follows:
for(start_condition; continue_condition; increment)
When the loop starts, the 'start_condition' intializes an incrementing variable with an assignment statement. After that, the incrementing variable is evaluated against the 'continue_condition' statemet to see if its value is true or false. If true, the iterating statements are executed, the variable incremented and evaluated again. Eventually, changes to the incrementing variable make the 'continue_condition' statement false, which causes the loop to stop.
Here is a practical example:
for(i = 0; i < 10 ; i++)
document.write("<BR>i = " + i);
So what this example is saying is:
The variable i is set to 0 to start with and the associated block of code is run. Then, using the increment operator ( ++ ), the value 1 is added to i. The i < 10 condition is evaluated. If i is still less than 10, then the loop repeats. So what you will see with this code is that i, with a BR tag following will be written to the browser screen 10 times.
hope this helps