Some operators have more precedence than others and hence they will be performed earlier than certain other operators if they are used in the same experession. Associativity determines how operators that have the same precedence are evaluated (where our choices are left-to-right, right-to-left, or nonassociative for those operators where order of evaluation is either not important, not guaranteed, or not even possible). Operators of a higher precedence (evaluated first) are higher up in the table than those of a lower precedence.
The following table elists the operators according to their precedence.
|++, --||non||Increment and decrement|
|!,~,\,+,-||right||Logical not, bitwise not, reference, unary +, unary -|
|=~, !~||left||Pattern Matching|
|*,/,%||left||Multiplication, Division, Modulus|
|+,-,.||left||Add, Subtract, String concatenate|
|<<, >>||left||Bitwise left shift and right shift|
|unary operators||non||Function-like operators|
|==, !=, <=>, eq, ne, cmp||non||Tests|
|,, =>||left||Comma operators|
|list operators||non||list operators used in list|
|or, xor||left||Logical OR, XOR|
© 2018 BreakInerview