May not be a bug, but this seems quite strange to me. If you create a loop and you want to use the loop counter variable to index stuff, see MWE:
Program Init Variables Robot Program Loop Loop_1<10 textmsg(Loop_1) sync()
Then the Loop_1 variable is neither initialized nor incremented in the script file:
$ 1 "Robot Program" $ 2 "Loop Loop_1<10" while (Loop_1<10): $ 3 "textmsg(Loop_1)" textmsg(Loop_1) $ 4 "sync()" sync() end
As if you created the loop to run X amount of times:
Program Robot Program Loop 10 times textmsg(Loop_1) sync()
Produces the following script code:
$ 1 "Robot Program" $ 2 "Loop 10 times" Loop_1 = 0 while (Loop_1 < 10): $ 3 "textmsg(Loop_1)" textmsg(Loop_1) $ 4 "sync()" sync() Loop_1 = Loop_1 + 1 end
You can force the Loop counter to be initialised in InitVariables but this just presents the user with an infinite loop.
I see two hacky and fast options; (1) add automatic initialization and incrementation of variables used in the “Loop when expression is True”, or (2) remove the possibility to use the Loop counter as the main component in the Expression (more tricky as you may want to use the Loop counter as an index of an array in the expression, so this might not be a possibility).
Otherwise the I find the right way would be to present the user with a choice to enable/disable automatically initialization and incrementation.