No, it's not a trick. PEMDAS gives the wrong answer. What's not to get? According to "PEMDAS", you multiply before you divide and you add before you subtract. In order to get the RIGHT answer, you have to remember PE(MD)(AS). And you're still screwed if you have to do 2^3^4 (there's some Math BBCode that I don't know how to use. It's supposed to be a big 2, a superscripted 3 above the 2, then a superscripted 4 over the 3. 2^(3^4)). The point being you have to learn "PEMDAS", then the "left to right" add/substract and multiply/divide exceptions, then you have to learn the "right to left" exponents exception. You're screwed if your teachers are as mean as mine were and throw curveballs like these at you in Algebra.

What wrong is using priorities? Looks working quite well. Google's Go language have very neat and simple priority system. Of course there bunch of cases where priorities are really messed up like famous Pascal boolean operations.

I always managed quite well with three priorities like they teached here in Finland in my school time, don't know situation nowadays: highest exponentiation (including roots, but that is only other name of exponentiation), then multiply/divide, last plus/minus. Then you only need to be carefull with minus in front of ( ) and - - is + stuff.

No, it's not a trick. PEMDAS gives the wrong answer. What's not to get? According to "PEMDAS", you multiply before you divide and you add before you subtract. In order to get the RIGHT answer, you have to remember PE(MD)(AS). And you're still screwed if you have to do 2^3^4 (there's some Math BBCode that I don't know how to use. It's supposed to be a big 2, a superscripted 3 above the 2, then a superscripted 4 over the 3. 2^(3^4)). The point being you have to learn "PEMDAS", then the "left to right" add/substract and multiply/divide exceptions, then you have to learn the "right to left" exponents exception. You're screwed if your teachers are as mean as mine were and throw curveballs like these at you in Algebra.

So exponents are the same as indices or are they everything but brackets, multiplication, division, addition and subtraction?

What wrong is using priorities? Looks working quite well. Google's Go language have very neat and simple priority system. Of course there bunch of cases where priorities are really messed up like famous Pascal boolean operations.

I always managed quite well with three priorities like they teached here in Finland in my school time, don't know situation nowadays: highest exponentiation (including roots, but that is only other name of exponentiation), then multiply/divide, last plus/minus. Then you only need to be carefull with minus in front of ( ) and - - is + stuff.

@Azmah
Yup BODMAS does work.
You see, according to it, in 6+2x10, you first multiply 2 and 10 and get 20, then add 6 and get 26, which is the correct answer.
By the way, we're also taught BODMAS in school.

Yeah, its probably Order of Operations. But why would you need to remember it in programming - The developer(s)who made it would need it; unless you want to know the term Oder Of Precedence for interests sake.

Correct, steven300. Its nice how you presented it logically - Its really helpful for those that want to learn. You could be a teacher ... if you aren't already. Someone doesn't need to be qualified to be a teacher, you know. :P

In some countries, replacing "Brackets" with "Parentheses" would be the case making it PODMAS/PIDMAS but I've never hear of PEMDAS. I'm assuming the "E" is representing another word for powers of or indices but why is the M and D switched?

The only time I was taught to do multiplication before division was when the sum was written as a fraction:

2x2
---
2

Rather than inline:

2x2/2

Using BIDMAS, it would make the answer to the first, 2 and the answer to the second, 1.