Solidity語言學習筆記————8、運算子優先順序

FLy_鵬程萬里發表於2018-06-22

運算子優先順序(Order of Precedence of Operators)

以下是按evaluation順序列出的運算子優先順序。

優先順序描述運算子
1Postfix increment and decrement++, --
1New expressionnew <typename>
1Array subscripting<array>[<index>]
1Member access<object>.<member>
1Function-like call<func>(<args...>)
1Parentheses(<statement>)
2Prefix increment and decrement++, --
2Unary plus and minus+, -
2Unary operationsdelete
2Logical NOT!
2Bitwise NOT~
3Exponentiation**
4Multiplication, division and modulo*, /, %
5Addition and subtraction+, -
6Bitwise shift operators<<, >>
7Bitwise AND&
8Bitwise XOR^
9Bitwise OR|
10Inequality operators<, >, <=, >=
11Equality operators==, !=
12Logical AND&&
13Logical OR||
14Ternary operator<conditional> ? <if-true> : <if-false>
15Assignment operators=, |=, ^=, &=, <<=, >>=, +=, -=, *=, /=, %=
16Comma operator,

相關文章