Calculations and Mathematical Operators
Doing mathematical operations in Blawx requires the use of two blocks, a “calculation” block, and a “Math Operator” block.
The calculation block looks like this:
In the calculation block, the variable on the left is set to the value return from the statements on the right. So for example, to set the value of a variable “the answer” to 42, you would do this:
You need to be careful to use a calculation block and not a variable assignment block when you want to do math. Only the calculation block will make the value of the variable the result of the expression. The assignment block will make the value of the variable the expression itself.
Once you have a calculation block you can use mathematical operator blocks inside it. The mathematical operator block looks like this:
The possible operators are addition (+), subtraction (-), multiplication (*), and division (/). They can also be nested, so to set the variable to the value of 2+4+5, you could do this:
Note that the nesting order does not determine the order of operations. The above statement means 2+4+5, not 2+(4+5). If you say 2*4+5, the answer will be 13, not 18.