Created
June 10, 2020 17:05
-
-
Save samelhusseini/dc55960c40c859a4dd315b78319ee28a to your computer and use it in GitHub Desktop.
Chained If / else blocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT | |
{ | |
"type": "custom_if", | |
"message0": "if %1 %2", | |
"args0": [ | |
{ | |
"type": "input_value", | |
"name": "NAME" | |
}, | |
{ | |
"type": "input_statement", | |
"name": "NAME" | |
} | |
], | |
"previousStatement": null, | |
"nextStatement": null, | |
"style": "logic_blocks", | |
"tooltip": "", | |
"helpUrl": "" | |
}, | |
{ | |
"type": "custom_else_if", | |
"message0": "else if %1 %2", | |
"args0": [ | |
{ | |
"type": "input_value", | |
"name": "NAME" | |
}, | |
{ | |
"type": "input_statement", | |
"name": "NAME" | |
} | |
], | |
"previousStatement": null, | |
"nextStatement": null, | |
"style": "logic_blocks", | |
"tooltip": "", | |
"helpUrl": "" | |
}, | |
{ | |
"type": "custom_else", | |
"message0": "else %1 %2", | |
"args0": [ | |
{ | |
"type": "input_dummy" | |
}, | |
{ | |
"type": "input_statement", | |
"name": "NAME" | |
} | |
], | |
"previousStatement": null, | |
"nextStatement": null, | |
"style": "logic_blocks", | |
"tooltip": "", | |
"helpUrl": "" | |
} | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xml xmlns="https://developers.google.com/blockly/xml"> | |
<block type="custom_if"> | |
<value name="NAME"> | |
<block type="logic_operation"> | |
<field name="OP">AND</field> | |
</block> | |
</value> | |
<next> | |
<block type="custom_else_if"> | |
<value name="NAME"> | |
<block type="logic_operation"> | |
<field name="OP">AND</field> | |
</block> | |
</value> | |
<next> | |
<block type="custom_else"></block> | |
</next> | |
</block> | |
</next> | |
</block> | |
</xml> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment