PDA

View Full Version : For Loop Query



balumail75
11-11-2011, 04:38 AM
Hello All,

In the nested for loops, How it works, if I increment the counter of first "for loop" in the second "for loop". For example,

for i = 1 to 10
for j = 1 to 10
........
i = i + 1
next j
next i

I want to work with each i with each j. Is there any other way to compare each i with each j?

Thanks for the explanation.

Regards,
Balu.

John Wilson
11-11-2011, 04:44 AM
I don't think you would ever increment a loop counter within the loop like that. Maybe explain clearly what you want to achieve.

balumail75
11-11-2011, 04:59 AM
Hi John,

I want to compare (for e.g.,) from 1 to 10 with 5 to 15.

each value 1 with 5, 2 with 6, 3 with 7 .....etc.,

Regards,
Balu.

Paul_Hossler
11-11-2011, 06:46 AM
Something to try maybe ???


For i = 1 to 10
If A(i) = B(i+4) then
....
Next i


Paul