mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10093 from ethereum/clarifyEvaluation
Clarify evaluation of arguments to require.
This commit is contained in:
commit
08a27b9c5b
@ -615,7 +615,13 @@ The following example shows how to use an error string together with ``revert``
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
The two syntax options are equivalent, it's developer preference which to use.
|
If you provide the reason string directly, then the two syntax options are equivalent, it is the developer's preference which one to use.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
The ``require`` function is evaluated just as any other function.
|
||||||
|
This means that all arguments are evaluated before the function itself is executed.
|
||||||
|
In particular, in ``require(condition, f())`` the function ``f`` is executed even if
|
||||||
|
``condition`` is true.
|
||||||
|
|
||||||
The provided string is :ref:`abi-encoded <ABI>` as if it were a call to a function ``Error(string)``.
|
The provided string is :ref:`abi-encoded <ABI>` as if it were a call to a function ``Error(string)``.
|
||||||
In the above example, ``revert("Not enough Ether provided.");`` returns the following hexadecimal as error return data:
|
In the above example, ``revert("Not enough Ether provided.");`` returns the following hexadecimal as error return data:
|
||||||
|
Loading…
Reference in New Issue
Block a user