diff options
author | chriseth <c@ethdev.com> | 2016-08-01 18:40:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-01 18:40:24 +0800 |
commit | 66133469e9422377747ff16f23b849e37f673ef1 (patch) | |
tree | a40531df98fb3f4d1a28c823d3ce717e25889651 /docs/miscellaneous.rst | |
parent | 8c5a56d8648c9722d96638bf6dc1be94c7828cb3 (diff) | |
parent | 5687beb424663871d3d59c6bd12d71fff79d5200 (diff) | |
download | dexon-solidity-66133469e9422377747ff16f23b849e37f673ef1.tar.gz dexon-solidity-66133469e9422377747ff16f23b849e37f673ef1.tar.zst dexon-solidity-66133469e9422377747ff16f23b849e37f673ef1.zip |
Merge pull request #732 from Denton-L/document-precedence
Document precedence
Diffstat (limited to 'docs/miscellaneous.rst')
-rw-r--r-- | docs/miscellaneous.rst | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst index 9b067fb1..76485745 100644 --- a/docs/miscellaneous.rst +++ b/docs/miscellaneous.rst @@ -202,6 +202,69 @@ Tips and Tricks Cheatsheet ********** +.. index:: precedence + +.. _order: + +Order of Precedence of Operators +================================ + +The following is the order of precedence for operators, listed in order of evaluation. + ++------------+-------------------------------------+--------------------------------------------+ +| Precedence | Description | Operator | ++============+=====================================+============================================+ +| *1* | Postfix increment and decrement | ``++``, ``--`` | ++ +-------------------------------------+--------------------------------------------+ +| | Function-like call | ``<func>(<args...>)`` | ++ +-------------------------------------+--------------------------------------------+ +| | Array subscripting | ``<array>[<index>]`` | ++ +-------------------------------------+--------------------------------------------+ +| | Member access | ``<object>.<member>`` | ++ +-------------------------------------+--------------------------------------------+ +| | Parentheses | ``(<statement>)`` | ++------------+-------------------------------------+--------------------------------------------+ +| *2* | Prefix increment and decrement | ``++``, ``--`` | ++ +-------------------------------------+--------------------------------------------+ +| | Unary plus and minus | ``+``, ``-`` | ++ +-------------------------------------+--------------------------------------------+ +| | Unary operations | ``after``, ``delete`` | ++ +-------------------------------------+--------------------------------------------+ +| | Logical NOT | ``!`` | ++ +-------------------------------------+--------------------------------------------+ +| | Bitwise NOT | ``~`` | ++------------+-------------------------------------+--------------------------------------------+ +| *3* | Exponentiation | ``**`` | ++------------+-------------------------------------+--------------------------------------------+ +| *4* | Multiplication, division and modulo | ``*``, ``/``, ``%`` | ++------------+-------------------------------------+--------------------------------------------+ +| *5* | Addition and subtraction | ``+``, ``-`` | ++------------+-------------------------------------+--------------------------------------------+ +| *6* | Bitwise shift operators | ``<<``, ``>>`` | ++------------+-------------------------------------+--------------------------------------------+ +| *7* | Bitwise AND | ``&`` | ++------------+-------------------------------------+--------------------------------------------+ +| *8* | Bitwise XOR | ``^`` | ++------------+-------------------------------------+--------------------------------------------+ +| *9* | Bitwise OR | ``|`` | ++------------+-------------------------------------+--------------------------------------------+ +| *10* | Inequality operators | ``<``, ``>``, ``<=``, ``>=`` | ++------------+-------------------------------------+--------------------------------------------+ +| *11* | Equality operators | ``==``, ``!=`` | ++------------+-------------------------------------+--------------------------------------------+ +| *12* | Logical AND | ``&&`` | ++------------+-------------------------------------+--------------------------------------------+ +| *13* | Logical OR | ``||`` | ++------------+-------------------------------------+--------------------------------------------+ +| *14* | Ternary operator | ``<conditional> ? <if-true> : <if-false>`` | ++------------+-------------------------------------+--------------------------------------------+ +| *15* | Assignment operators | ``=``, ``|=``, ``^=``, ``&=``, ``<<=``, | +| | | ``>>=``, ``+=``, ``-=``, ``*=``, ``/=``, | +| | | ``%=`` | ++------------+-------------------------------------+--------------------------------------------+ +| *16* | Comma operator | ``,`` | ++------------+-------------------------------------+--------------------------------------------+ + .. index:: block, coinbase, difficulty, number, block;number, timestamp, block;timestamp, msg, data, gas, sender, value, now, gas price, origin, sha3, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography, this, super, selfdestruct, balance, send Global Variables |