Fix python loop (#4007)

* Fix code generation for python controls_for

* Update python golden file.
This commit is contained in:
Monica Kozbial
2020-06-30 11:35:48 -07:00
committed by GitHub
parent 5c4677010c
commit fcc3a09661
3 changed files with 7 additions and 6 deletions

View File

@@ -156,13 +156,14 @@ Blockly.Python['controls_for'] = function(block) {
if (typeof startVar == 'number' && typeof endVar == 'number') {
if (startVar < endVar) {
range = defineUpRange(startVar, endVar, increment);
range = defineUpRange();
} else {
range = defineDownRange(startVar, endVar, increment);
range = defineDownRange();
}
range += '(' + startVar + ', ' + endVar + ', ' + incVar + ')';
} else {
// We cannot determine direction statically.
range = generateUpDownRange(startVar, endVar, increment);
range = generateUpDownRange(startVar, endVar, incVar);
}
}
code += 'for ' + variable0 + ' in ' + range + ':\n' + branch;