Order of evaluation: addition, subtraction, multiplication, division
Symbols
+ for addition, as in 4+5
- for subtraction, as in 4–5
* for multiplication, as in 4*5 (Note that in math we also use
"My Dear Aunt Sally" to indicate multiplication and division, left to right,
followed by addition and subtraction
"Dear Me, So Angry" to point out that multiplication and division are treated as
having equal precedence, as are addition and subtraction
Do examples
Include parentheses
Enclosing a part of a computation in parenthesis means that we need to
evaluate within the parentheses before evaluating operations next to the parentheses.
Example: (9–4)*(7+12/3)
Again, in math we often use implied multiplication, as in (9–4)(7+12/3), but this
is not recognized in most programming languages.
Do examples
Include exponentiation
Exponentiation is raising a base number to a power, as in 4³ to mean 4 to the third
power or 4*4*4. In that example, 4 is the base and 3 is the exponent.
The base does not have to be an integer; we can have 3.452²
The exponent does not have to be an integer; we can have