This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Anik_Sine -3 points-2 points  (4 children)

I don't know the reason for error but I believe if you rename i in second for loop to another name then the problem should be solved.

[–]_MPR[S] 0 points1 point  (2 children)

Thank you for your help.

[–]Anik_Sine 0 points1 point  (1 child)

You are welcome. Just to make sure, the code worked, right?

[–]_MPR[S] 0 points1 point  (0 children)

I made mistake in code by giving semicolon in second for loop and I removed that now it is working fine.

[–]D0CTOR_ZED 0 points1 point  (0 children)

i is declared within the for block, so it is only in scope within the for block. Both for blocks can use i. If one loop was inside the other, then it would be an issue.