0% found this document useful (0 votes)
2 views

Operators and Precedence

Uploaded by

SMITA SINGH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Operators and Precedence

Uploaded by

SMITA SINGH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Please see the following precedence and associativity table for reference.

This table
lists all operators from the highest precedence to the lowest precedence.
Precedence Table (high to low precedence)
Operator Description Associativity
() Parentheses left-to-right
** Exponent right-to-left
+x, -x, ~x Unary plus, Unary minus, Bitwise NOT left-to-right
*, /, %, // Multiplication/division/modulus/floor division left-to-right
+, – Addition/subtraction left-to-right
(Bitwise shift operator)Bitwise shift left, Bitwise shift
<< ,>> left-to-right
right
& Bitwise AND left-to-right
^ Bitwise exclusive OR (XOR) left-to-right
| Bitwise inclusive OR left-to-right
Comaprison operator
<,<=,
>,>= Relational less than/less than or equal to
Relational greater than/greater than or equal to. left-to-right
== ,!=
Relational is equal to/is not equal toleft-to-right

is, is not Identity


left-to-right
in, not in Membership operators

= Assignment
+= ,-= Addition/subtraction assignment
*= ,/= Multiplication/division assignment
right-to-left
%=, &= Modulus/bitwise AND assignment
^= ,|= Bitwise exclusive/inclusive OR assignment
<<= ,>>= Bitwise shift left/right assignment
not Logical NOT right-to-left
and Logical AND left-to-right
or Logical OR left-to-right

You might also like