Counter variable in FOR loop is already used in another loop

Navigation:  Messages > Macro Compiler Messages > Errors >

Counter variable in FOR loop is already used in another loop

Previous pageReturn to chapter overviewNext page

This compiler error will occur if you use the same counter variable in 2 nested for loops. An example would be :

 

 for nTemp = 1 to 12 step 1

         for nTemp = 1 to 31 step 1 {<- wrong}

                 // do something

         endfor

 endfor

 

Note that the counter variable can be reused anywhere else in the macro,

 

begin  

  for nTemp = 1 to 12 step 1  

      // do something

  endfor

  for nTemp = 1 to 31 step 1 // OK

      // do something else

  endfor

end                          

 

but not inside a loop that already uses the same loop counter.


Topic 109007 updated on 11-Apr-2002.
Topic URL: http://www.qppstudio.net/webhelp/index.html?countervariableinforloopislare.htm