Skip to content

Exponent Block PR 2 #3193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions blocks_vertical/default_toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,12 @@ Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: no
'</shadow>' +
'</value>' +
'</block>' +
'<block type="operator_exponent" id="operator_exponent">' +
'<value name="NUM1">' +
'<shadow type="math_number">' +
'<field name="NUM"></field>' +
'</shadow>' +
'</value>' +
'<block type="operator_random" id="operator_random">' +
'<value name="FROM">' +
'<shadow type="math_number">' +
Expand Down
24 changes: 23 additions & 1 deletion blocks_vertical/operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,29 @@ Blockly.Blocks['operator_divide'] = {
});
}
};

Blockly.Blocks['operator_exponent'] = {
/**
* Block for raising one number to the power of another.
* @this Blockly.Block
*/
init: function() {
this.jsonInit({
"message0": Blockly.Msg.OPERATORS_EXPONENT,
"args0": [
{
"type": "input_value",
"name": "NUM1"
},
{
"type": "input_value",
"name": "NUM2"
}
],
"category": Blockly.Categories.operators,
"extensions": ["colours_operators", "output_number"]
});
}
};
Blockly.Blocks['operator_random'] = {
/**
* Block for picking a random number.
Expand Down
1 change: 1 addition & 0 deletions msg/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ Blockly.Msg.OPERATORS_ADD = '%1 + %2';
Blockly.Msg.OPERATORS_SUBTRACT = '%1 - %2';
Blockly.Msg.OPERATORS_MULTIPLY = '%1 * %2';
Blockly.Msg.OPERATORS_DIVIDE = '%1 / %2';
Blockly.Msg.OPERATORS_EXPONENT = '%1 ^ %2';
Blockly.Msg.OPERATORS_RANDOM = 'pick random %1 to %2';
Blockly.Msg.OPERATORS_GT = '%1 > %2';
Blockly.Msg.OPERATORS_LT = '%1 < %2';
Expand Down