aboutsummaryrefslogtreecommitdiffstats
path: root/docs/control-structures.rst
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-13 07:28:29 +0800
committerGitHub <noreply@github.com>2018-07-13 07:28:29 +0800
commit31e56f9f9976cee44f000226318dca566f0f0b79 (patch)
tree1130854f705de884c446ae7b860a424c77b889b0 /docs/control-structures.rst
parentbab4a3975fd9f49850d11337dc6abf00a2542f1d (diff)
parent3ebfcae8292da1d9f41ff20da1866c424404ee58 (diff)
downloaddexon-solidity-31e56f9f9976cee44f000226318dca566f0f0b79.tar.gz
dexon-solidity-31e56f9f9976cee44f000226318dca566f0f0b79.tar.zst
dexon-solidity-31e56f9f9976cee44f000226318dca566f0f0b79.zip
Merge pull request #4438 from ethereum/address_members_external_tests_docs
Address members used by contracts: update external tests and docs
Diffstat (limited to 'docs/control-structures.rst')
-rw-r--r--docs/control-structures.rst8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index 837a0a90..ead236c4 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -418,18 +418,18 @@ a message string for ``require``, but not for ``assert``.
::
- pragma solidity ^0.4.22;
+ pragma solidity >0.4.24;
contract Sharer {
function sendHalf(address addr) public payable returns (uint balance) {
require(msg.value % 2 == 0, "Even value required.");
- uint balanceBeforeTransfer = this.balance;
+ uint balanceBeforeTransfer = address(this).balance;
addr.transfer(msg.value / 2);
// Since transfer throws an exception on failure and
// cannot call back here, there should be no way for us to
// still have half of the money.
- assert(this.balance == balanceBeforeTransfer - msg.value / 2);
- return this.balance;
+ assert(address(this).balance == balanceBeforeTransfer - msg.value / 2);
+ return address(this).balance;
}
}