Operator precedence and associativity
Last updated
Was this helpful?
Last updated
Was this helpful?
Before listing the table, I will explain for short what precedence and associativty mean.
Which operator function gets called first. Functions are called in order of precedence (HIGHER precedence wins).
When functions have the same precedence, the engine looks at Associativity, in which order the operator functions get called in: left-to-right or right-to-left.
The highest precedence (), will always run first, for example (2+3) * 2 will have the result 10 but 2+3 * 2 will have the result 8, all because of the precedence of the operator, β*β has the precedence 14 while β+β itβs 13.
Not because this is how we as humans calculate math, but because of precedence.
We will start from the higher precedence (19):