function updateShape_() {
    if (this.itemCount_ && this.getInput('EMPTY')) {
      this.removeInput('EMPTY');
    } else if (!this.itemCount_ && !this.getInput('EMPTY')) {
      this.appendDummyInput('EMPTY').appendField('create empty set');
    } // Add new inputs.


    for (var i = 0; i < this.itemCount_; i++) {
      if (!this.getInput('ADD' + i)) {
        var input = this.appendValueInput('ADD' + i);

        if (i === 0) {
          input.appendField('create set with {').setAlign(Blockly.ALIGN_RIGHT);
        } else {
          input.appendField(',').setAlign(Blockly.ALIGN_RIGHT);
        }
      }
    } // Remove deleted inputs.


    while (this.getInput('ADD' + i)) {
      this.removeInput('ADD' + i);
      i++;
    } // Add the trailing "]"


    if (this.getInput('TAIL')) {
      this.removeInput('TAIL');
    }

    if (this.itemCount_) {
      this.appendDummyInput('TAIL').appendField('}').setAlign(Blockly.ALIGN_RIGHT);
    }
  }
/**
   * Modify this block to have the correct number of inputs.
   * @private
   * @this Blockly.Block
   */
Modify this block to have the correct number of inputs.
Modify this block to have the correct number of inputs .
function updateShape_() {
    if (this.itemCount_ && this.getInput('EMPTY')) {
      this.removeInput('EMPTY');
    } else if (!this.itemCount_ && !this.getInput('EMPTY')) {
      this.appendDummyInput('EMPTY').appendField('create empty set');
    } 
    for (var i = 0; i < this.itemCount_; i++) {
      if (!this.getInput('ADD' + i)) {
        var input = this.appendValueInput('ADD' + i);
        if (i === 0) {
          input.appendField('create set with {').setAlign(Blockly.ALIGN_RIGHT);
        } else {
          input.appendField(',').setAlign(Blockly.ALIGN_RIGHT);
        }
      }
    } 
    while (this.getInput('ADD' + i)) {
      this.removeInput('ADD' + i);
      i++;
    } 
    if (this.getInput('TAIL')) {
      this.removeInput('TAIL');
    }
    if (this.itemCount_) {
      this.appendDummyInput('TAIL').appendField('}').setAlign(Blockly.ALIGN_RIGHT);
    }
  }
function updateShape_ ( ) { if ( this . itemCount_ && this . getInput ( 'EMPTY' ) ) { this . removeInput ( 'EMPTY' ) ; } else if ( ! this . itemCount_ && ! this . getInput ( 'EMPTY' ) ) { this . appendDummyInput ( 'EMPTY' ) . appendField ( 'create empty set' ) ; } for ( var i = 0 ; i < this . itemCount_ ; i ++ ) { if ( ! this . getInput ( 'ADD' + i ) ) { var input = this . appendValueInput ( 'ADD' + i ) ; if ( i === 0 ) { input . appendField ( 'create set with {' ) . setAlign ( Blockly . ALIGN_RIGHT ) ; } else { input . appendField ( ',' ) . setAlign ( Blockly . ALIGN_RIGHT ) ; } } } while ( this . getInput ( 'ADD' + i ) ) { this . removeInput ( 'ADD' + i ) ; i ++ ; } if ( this . getInput ( 'TAIL' ) ) { this . removeInput ( 'TAIL' ) ; } if ( this . itemCount_ ) { this . appendDummyInput ( 'TAIL' ) . appendField ( '}' ) . setAlign ( Blockly . ALIGN_RIGHT ) ; } }
Modify this block to have the correct number of inputs.
Modify this block to have the correct number of inputs .
// Add new inputs. // Remove deleted inputs. // Add the trailing "]"