Closed GoogleCodeExporter closed 8 years ago
Looking at this further I can see that what uses should be doing is creating a
new variable for the loop index from the context menu. However the few people
I've asked to try using Blockly wih nested loops all tried rename rather than
new. Possibly because they didn't realise the loop index was a variable.
For what its worth I've attached the source of a function I added to the core
variables.js file. This generates a unique variable name starting from 'a'
through to 'z' and then 'a1' etc.
This function is then called in the language/control.js file for the count and
for-each loops:
this.addInput('with',
Blockly.LOCAL_VARIABLE).setText(Blockly.Variables.generateUniqueName());
Feel free to use the attached code as you see fit.
Gary
Original comment by ratcliff...@gmail.com
on 7 Jun 2012 at 1:00
Attachments:
like this idea , patched in r405.
The variable will start from i to z, and skip "l" to avoid i/l confusion.
Original comment by gasolin
on 2 Sep 2012 at 8:56
Original issue reported on code.google.com by
ratcliff...@gmail.com
on 7 Jun 2012 at 9:46