mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
docs: Clarify the difference between denominations and literal suffixes
This commit is contained in:
parent
edcc3af9c8
commit
a15881092c
@ -196,6 +196,7 @@ can still return a value to the caller by use of the ``return`` statement.
|
||||
}
|
||||
|
||||
.. index:: ! literal suffix; suffix call syntax
|
||||
.. _function-calls-suffix-calls:
|
||||
|
||||
Suffix Calls
|
||||
------------
|
||||
@ -231,6 +232,15 @@ first in order to obtain the two input values.
|
||||
See the section on :ref:`calling suffix functions<calling_suffix_functions>` for more information
|
||||
on the limitations of this call syntax.
|
||||
|
||||
.. note::
|
||||
Suffix calls should not be confused with the application of :ref:`denomination suffixes<denominations>`,
|
||||
which use the same syntax, but simply modify the literal without an actual function call.
|
||||
|
||||
There is only a limited number of denominations and their names cannot be used for literal
|
||||
suffixes.
|
||||
The only exceptions are ``finney`` and ``szabo``, which used to be denominations, but were
|
||||
deprecated, and are now usable as identifiers.
|
||||
|
||||
|
||||
.. index:: ! new, contracts;creating
|
||||
|
||||
|
@ -5,12 +5,21 @@
|
||||
Units and Globally Available Variables
|
||||
**************************************
|
||||
|
||||
Solidity defines several *denominations*, which can be applied as suffixes to
|
||||
:ref:`rational number literals<rational_literals>` to modify the value while still keeping it a literal.
|
||||
|
||||
.. note::
|
||||
Denominations should not be confused with :ref:`literal suffixes<literal_suffixes>`, which use
|
||||
the same syntax, but can be defined by the user and result in a
|
||||
:ref:`function call<function-calls-suffix-calls>`.
|
||||
|
||||
.. index:: ! wei, ! finney, ! szabo, ! gwei, ! ether, ! denomination;ether
|
||||
|
||||
Ether Units
|
||||
===========
|
||||
|
||||
A literal number can take a suffix of ``wei``, ``gwei`` or ``ether`` to specify a subdenomination of Ether, where Ether numbers without a postfix are assumed to be Wei.
|
||||
A literal number can take a suffix of ``wei``, ``gwei`` or ``ether`` to specify a sub-denomination of
|
||||
Ether, where Ether numbers without a postfix are assumed to be Wei.
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
@ -19,7 +28,7 @@ A literal number can take a suffix of ``wei``, ``gwei`` or ``ether`` to specify
|
||||
assert(1 gwei == 1e9);
|
||||
assert(1 ether == 1e18);
|
||||
|
||||
The only effect of the subdenomination suffix is a multiplication by a power of ten.
|
||||
The only effect of the sub-denomination suffix is a multiplication by a power of ten.
|
||||
|
||||
.. note::
|
||||
The denominations ``finney`` and ``szabo`` have been removed in version 0.7.0.
|
||||
|
Loading…
Reference in New Issue
Block a user