工具介紹: 運算符優先級。

Java 運算符優先級
運算符 優先級
postfix expr++ expr--
unary ++expr --expr +expr -expr ~ !
multiplicative * / %
additive + -
shift << >> >>>
relational < > <= >= instanceof
equality == !=
bitwise AND &
bitwise exclusive OR ^
bitwise inclusive OR |
logical AND &&
logical OR ||
ternary ? :
assignment = += -= *= /= %= &= ^= |= <<= >>= >>>=
C++運算符優先級
Precedence Operator Description Associativity
1 :: Scope resolution Left-to-right
2 ++   -- Suffix/postfix increment and decrement
() Function call
[] Array subscripting
. Element selection by reference
?> Element selection through pointer
3 ++   -- Prefix increment and decrement Right-to-left
+   ? Unary plus and minus
!   ~ Logical NOT and bitwise NOT
(type) Type cast
* Indirection (dereference)
& Address-of
sizeof Size-of
new, new[] Dynamic memory allocation
delete, delete[] Dynamic memory deallocation
4 .*   ->* Pointer to member Left-to-right
5 *   /   % Multiplication, division, and remainder
6 +   ? Addition and subtraction
7 <<   >> Bitwise left shift and right shift
8 <   <= For relational operators < and ≤ respectively
>   >= For relational operators > and ≥ respectively
9 ==   != For relational = and ≠ respectively
10 & Bitwise AND
11 ^ Bitwise XOR (exclusive or)
12 | Bitwise OR (inclusive or)
13 && Logical AND
14 || Logical OR
15 ?: Ternary conditional Right-to-Left
16 = Direct assignment (provided by default for C++ classes)
+=   ?= Assignment by sum and difference
*=   /=   %= Assignment by product, quotient, and remainder
<<=   >>= Assignment by bitwise left shift and right shift
&=   ^=   |= Assignment by bitwise AND, XOR, and OR
17 throw Throw operator (for exceptions)
18 , Comma Left-to-right
C語言運算符優先級
Precedence Operator Description Associativity
1 ++ -- Suffix/postfix increment and decrement Left-to-right
() Function call
[] Array subscripting
. Structure and union member access
?> Structure and union member access through pointer
(type){list} Compound literal(C99)
2 ++ -- Prefix increment and decrement Right-to-left
+ ? Unary plus and minus
! ~ Logical NOT and bitwise NOT
(type) Type cast
* Indirection (dereference)
& Address-of
sizeof Size-of
_Alignof Alignment requirement(C11)
3 * / % Multiplication, division, and remainder Left-to-right
4 + ? Addition and subtraction
5 << >> Bitwise left shift and right shift
6 < <= For relational operators < and ≤ respectively
> >= For relational operators > and ≥ respectively
7 == != For relational = and ≠ respectively
8 & Bitwise AND
9 ^ Bitwise XOR (exclusive or)
10 | Bitwise OR (inclusive or)
11 && Logical AND
12 || Logical OR
13 ?: Ternary conditional Right-to-Left
14 = Simple assignment
+= ?= Assignment by sum and difference
*= /= %= Assignment by product, quotient, and remainder
<<= >>= Assignment by bitwise left shift and right shift
&= ^= |= Assignment by bitwise AND, XOR, and OR
15 , Comma Left-to-right
PHP運算符優先級
結合方向 運算符 附加信息
非結合 clone new clone 和 new
[ array()
非結合 ++ -- 遞增/遞減運算符
非結合 ~ - (int) (float) (string) (array) (object) (bool) @ 類型
非結合 instanceof 類型
右結合 ! 邏輯操作符
* / % 算術運算符
+ - . 算術運算符 和 字符串運算符
<< >> 位運算符
非結合 < <= > >= <> 比較運算符
非結合 == != === !== 比較運算符
& 位運算符 和 引用
^ 位運算符
| 位運算符
&& 邏輯運算符
|| 邏輯運算符
? : 三元運算符
= += -= *= /= .= %= &= |= ^= <<= >>= 賦值運算符
and 邏輯運算符
xor 邏輯運算符
or 邏輯運算符
, 多處用到

這個表給出Python的運算符優先級(從低到高).

從最低的優先級(最松散地結合)到最高的優先級(最緊密地結合)。

這意味著在一個表達式中,Python會首先計算表中較下面的運算符,然后在計算列在表上部的運算符。

Python 運算符優先級
運算符 描述
lambda Lambda表達式
or 布爾“或”
and 布爾“與”
not x 布爾“非”
in,not in 成員測試
is,is not 同一性測試
<,<=,>,>=,!=,== 比較
| 按位或
^ 按位異或
& 按位與
<<,>> 移位
+,- 加法與減法
*,/,% 乘法、除法與取余
+x,-x 正負號
~x 按位翻轉
** 指數
x.attribute 屬性參考
x[index] 下標
x[index:index] 尋址段
f(arguments...) 函數調用
(experession,...) 綁定或元組顯示
[expression,...] 列表顯示
{key:datum,...} 字典顯示
'expression,...' 字符串轉換

主站蜘蛛池模板: 久久一区二区三区99| 久久无码AV一区二区三区| 亚洲无删减国产精品一区| 狠狠爱无码一区二区三区| 国产一区二区三区免费看| 国产伦精品一区二区三区精品| 亚洲熟妇av一区二区三区漫画| V一区无码内射国产| 国产一区二区三区乱码| 国模精品视频一区二区三区| 一区国严二区亚洲三区| 国产日韩一区二区三区在线观看| 国产精品视频无圣光一区| 一区二区三区免费视频观看| 成人精品一区二区三区电影| 丰满少妇内射一区| 男插女高潮一区二区| 激情综合丝袜美女一区二区| 精品国产日韩亚洲一区91| 久久一区二区三区精华液使用方法| 日本人真淫视频一区二区三区| 夜精品a一区二区三区| 91亚洲一区二区在线观看不卡| 蜜臀AV在线播放一区二区三区| 亚洲国产精品乱码一区二区| 亚洲综合一区国产精品| 色视频综合无码一区二区三区| 日韩精品区一区二区三VR| 国产日韩精品一区二区在线观看播放 | 无码人妻精品一区二区三区99不卡 | 亚洲制服丝袜一区二区三区| 亚洲免费视频一区二区三区| 一本岛一区在线观看不卡| 精品无码综合一区| 好吊妞视频一区二区| 亚洲爆乳无码一区二区三区| 人妻激情偷乱视频一区二区三区| 少妇无码一区二区三区免费| 人妻少妇精品视频一区二区三区| 无码av免费毛片一区二区| 国产精品久久久久久一区二区三区 |