Operator Precedence


The precedence of an operator determines which operations will be evaluated first. As you know from math, parentheses raise the precedence of part of an expression. An example:
5 * 5 + 5 = 30
Because multiplication has a higher precedence than addition, 5*5 will be performed before 5+5. If we want the addition to be done first, we use parentheses to raise the precedence of part of the expression:
5 * (5 + 5) = 50
In this case, 5+5 was peformed before the multiplication and the result was much different.