0% found this document useful (0 votes)
12 views2 pages

Operator Precedence

The document outlines the operator precedence in programming, detailing the order of operations for various operators, their descriptions, and associativity. It categorizes operators from parentheses to assignment expressions, indicating how they should be evaluated in expressions. The precedence ranges from highest (parentheses) to lowest (assignment), with specific rules for associativity.

Uploaded by

sahiljamwal2720
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Operator Precedence

The document outlines the operator precedence in programming, detailing the order of operations for various operators, their descriptions, and associativity. It categorizes operators from parentheses to assignment expressions, indicating how they should be evaluated in expressions. The precedence ranges from highest (parentheses) to lowest (assignment), with specific rules for associativity.

Uploaded by

sahiljamwal2720
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Operator Precedence

Precedence Operators Description Associativity

1 () Parentheses Left to right

Subscription,
2 x[index], x[index:index] Left to right
slicing

Await
3 await x N/A
expression

Exponentiatio
4 ** Right to left
n

Positive,
5 +x, -x, ~x negative, Right to left
bitwise NOT

Multiplication,
matrix,
6 *, @, /, //, % division, floor Left to right
division,
remainder

Addition and
7 +, – Left to right
subtraction

8 <<, >> Shifts Left to right

9 & Bitwise AND Left to right

10 ^ Bitwise XOR Left to right

11 | Bitwise OR Left to right


Precedence Operators Description Associativity

Comparisons,
in, not in, is, is membership
12 Left to Right
not, <, <=, >, >=, !=, == tests, identity
tests

13 not x Boolean NOT Right to left

14 and Boolean AND Left to right

15 or Boolean OR Left to right

Conditional
16 if-else Right to left
expression

Lambda
17 lambda N/A
expression

Assignment
expression
18 := Right to left
(walrus
operator)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy