About loop block

75 views
Skip to first unread message

Swapnil Dalimbe

unread,
Mar 30, 2021, 8:40:44 AM3/30/21
to Blockly
hey can anyone suggest Blockly defination of this loop block as mention below in imageScreenshot_2021-03-30 Blockly Demo Maximum Block Limit.png

feni...@google.com

unread,
Mar 30, 2021, 4:58:00 PM3/30/21
to Blockly
The repeat block is one of our core blocks. Here's the json definition, which you can also find in the blocks folder of the repository.
{
"type": "controls_repeat_ext",
"message0": "%{BKY_CONTROLS_REPEAT_TITLE}",
"args0": [{
"type": "input_value",
"name": "TIMES",
"check": "Number"
}],
"message1": "%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",
"args1": [{
"type": "input_statement",
"name": "DO"
}],
"previousStatement": null,
"nextStatement": null,
"style": "loop_blocks",
"tooltip": "%{BKY_CONTROLS_REPEAT_TOOLTIP}",
"helpUrl": "%{BKY_CONTROLS_REPEAT_HELPURL}"
},

If you want XML for those blocks, you can create the block combination in your Blockly workspace (or in the playground) and then export to XML. Here it is:

  <block type="controls_repeat_ext" >
    <value name="TIMES">
      <block type="math_number">
        <field name="NUM">10</field>
      </block>
    </value>
  </block>
</xml>

Swapnil Dalimbe

unread,
Mar 31, 2021, 8:15:20 AM3/31/21
to blo...@googlegroups.com
Can i get blockly defination in javascript of this block

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/e0bcf5b5-94d0-4e29-a2ce-31efc8092a5fn%40googlegroups.com.

feni...@google.com

unread,
Apr 5, 2021, 7:14:36 PM4/5/21
to Blockly
I don't have a javascript definition at hand, but you can either construct it from the json or just call jsonInit(jsonDefinition) in your init function in a javascript definition.

Rachel

Reply all
Reply to author
Forward
0 new messages