[this page | pdf | back links]
adopts the following operator
precedence (which is broadly in line with most other main-stream object
orientated programming languages). In this list earlier means higher precedence
(i.e. applied before later operators on the list), with operators with equal
precedence grouped together:
determines the order in which operators of the same precedence are processed.
Left-to-right means that a OP b OP c is processed as (a OP b) OP c.
Right-to-left means that a OP b OP c is processed as a OP (b OP c).
Assignment operators are
right-associative (i.e. right-to-left) so that a
= b = 4 will result in both a
and b being given the value of 4. This is because the assignment
operator returns the value that is assigned, i.e. (b=4) returns 4,
which is then assigned to a.