Operators: plus minus multiply divide
-
Prerequisite
Description
The Plus(+), Minus(-), Multiply(*) and Divide(/) blocks are Reporter Blocks in the Operators category.
These blocks are used to Add, Subtract, Multiply and Divide two numbers. Since they are reporter blocks, the calculation results will be reported as the value of the block.
Using Variables as Input
You can also use “variables” as input in these blocks. After assigning a value to a variable, you can place the variable inside the operator’s input box:
Saving the Result in a Variable
You can store the result from the operation in a variable, then display that variable’s value in the stage window like this:
Nested Operator Blocks
You can also put an operator block inside the input box of another operator block to create “Nested Operators”. Note that the order of the nested operator blocks is important: For example, 1 + (3*2) and (1+3) * 2 will give different answers.