title: Nesting custom Blockly blocks into loops and generating the code
body: <p>I am new to blockly and I am playing arround with creating custom blocks.</p>
  
  <p>I've created a new file (move.js) in the blocks folder and there I created some custom blocks. All of them have similar structure, like the one below</p>
  
  <pre><code>Blockly.Blocks['move_forward'] = {
    init: function() {
      this.appendDummyInput()
          .appendField("Move Forward");
      this.appendDummyInput()
          .appendField(new Blockly.FieldImage("http://iosites.org/robotino/front.png", 20, 20, "Forward"));
      this.setInputsInline(true);
      this.setPreviousStatement(true, null);
      this.setNextStatement(true, null);
      this.setColour(120);
      this.setTooltip('');
      this.setHelpUrl('http://www.example.com/');
    }
  };
  </code></pre>
  
  <p>Then I created a new file (move.js) in the generators/javascript folder and there I wrote very simple generators for the blocks (they only return a letter).</p>
  
  <pre><code>Blockly.JavaScript['move_forward'] = function(block) {
    return ['F;'];
  };
  </code></pre>
  
  <p>The blocks work OK and return the text they are supposed to when stacked outside loops. But when I nest them inside a repeat or a while loop something happens and there is nothing returning. I have done some testing and I think that the problem occurs when the</p>
  
  <pre><code>Blockly.JavaScript.statementToCode
  </code></pre>
  
  <p>is called inside the repeat generator for my custom blocks.</p>