Making calculations and compare numbers.
PEMDAS on Wikipedia.
Now let’s see what we can do with this. Note that in the examples after > is what we enter in the console and after => is what gets returned from the code. Now we can make simple calculations like:
> 14 - 5
> 10 * 3
> 25 / 5
> 9 + 12
Now let’s see a few longer and more complicated sums where we also use the
> (3 + 8) * 5 11 * 5
Example 1: first we do the part within the Parenthesis (3 + 8) = 11 after that we can multiply the 11 by 5 what gives the result of 55.
> (6 * 3) + 2 - 10 / 2 18 + 2 - 10 / 2 18 + 2 - 5
Example 2: We first multiply the part within the Parenthesis, then we devide the 10 by 2. And after that we can add 2 to 18 and subtract the 5 what gives a result of 15.
> (-8 * 4) - 4 * -3 -32 - 4 * -3 -32 - -12
Example 3: Again we Multiply the part in the Parenthesis first. Then we Multiply the -4 by -3 and then we Subtract the results what gives the result of -44.
false statement to your console. Now let’s see this in action.
> 9 > 2
greater then: is 9 greater then 2 returns
> 14 < 9
less then: is 14 less then 9 returns
> 9 >= -11
greater then or equal to: is 9 greater then or equal to -11 returns
> 6 == 1
equal to: is 6 equal to 1 returns
> 9 != 7
not equal to: is 9 not equal to 7 returns
Posted by Alex Lagendijk