mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
Fix python loop (#4007)
* Fix code generation for python controls_for * Update python golden file.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user