sets.js 527 B

1234567891011121314151617
  1. 'use strict';
  2. goog.provide('Blockly.Python.sets');
  3. goog.require('Blockly.Python');
  4. Blockly.Python['set_create'] = function(block) {
  5. // Create a list with any number of elements of any type.
  6. var elements = new Array(block.itemCount_);
  7. console.log(block.itemCount_)
  8. for (var i = 0; i < block.itemCount_; i++) {
  9. elements[i] = Blockly.Python.valueToCode(block, 'ADD' + i,
  10. Blockly.Python.ORDER_NONE) || '___';
  11. }
  12. var code = '{' + elements.join(', ') + '}';
  13. return [code, Blockly.Python.ORDER_ATOMIC];
  14. }