mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
Add a block to reverse a list (#844)
This commit is contained in:
committed by
Andrew n marshall
parent
f6168e1364
commit
46316c7cea
@@ -353,3 +353,11 @@ Blockly.Python['lists_split'] = function(block) {
|
||||
}
|
||||
return [code, Blockly.Python.ORDER_FUNCTION_CALL];
|
||||
};
|
||||
|
||||
Blockly.Python['lists_reverse'] = function(block) {
|
||||
// Block for reversing a list.
|
||||
var list = Blockly.Python.valueToCode(block, 'LIST',
|
||||
Blockly.Python.ORDER_NONE) || '[]';
|
||||
var code = 'list(reversed(' + list + '))';
|
||||
return [code, Blockly.Python.ORDER_FUNCTION_CALL];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user