Operator precedence means the order in which logical or arithmetic operations are performed. We are all familiar with the idea that:
3+4/2means three added to four-divided-by-two and not three- plus-four divided by two, so that the answer is 5 and not 3.5.
Here is a complete list of operator precedences:
x pX y x pT y x pow y x / y x * y x - y x + y x < y x > y x <= y x >= y x != y x = y x & y x | yThe higher up an operator is, the sooner it is performed, as if it was enclosed in a pair of brackets. Operators in the same line are evaluated left to right, in the order in which they are read. This means that writing:
c1+c2*c3+c4powc5*4pt15is equivalent to writing:
c1 + (c2*c3) + ((c4powc5)*(4pt15))but that writing:
c1-c2+c3is equivalent to writing:
(c1-c2)+c3If you want the operations carried out in any other order then you have to explicitly specify it yourself using brackets.
Note that you do not have to use brackets in the expression:
(c5>5)&(c5<10)because:
c5>5&c5<10will be interpreted in exactly the same way - the > and < take precedence over the&.