diff options
author | Dave Hoover <dave.hoover@gmail.com> | 2016-06-25 20:11:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-25 20:11:45 +0800 |
commit | b31bd4a2e4feb365a8d9f0a5800817dffeaa837d (patch) | |
tree | 053fa951812fe759fa2bb34549b40273833e49a6 /docs | |
parent | b23c30079283095e54eb9678a88dda95d895dd6e (diff) | |
download | dexon-solidity-b31bd4a2e4feb365a8d9f0a5800817dffeaa837d.tar dexon-solidity-b31bd4a2e4feb365a8d9f0a5800817dffeaa837d.tar.gz dexon-solidity-b31bd4a2e4feb365a8d9f0a5800817dffeaa837d.tar.bz2 dexon-solidity-b31bd4a2e4feb365a8d9f0a5800817dffeaa837d.tar.lz dexon-solidity-b31bd4a2e4feb365a8d9f0a5800817dffeaa837d.tar.xz dexon-solidity-b31bd4a2e4feb365a8d9f0a5800817dffeaa837d.tar.zst dexon-solidity-b31bd4a2e4feb365a8d9f0a5800817dffeaa837d.zip |
Fixing library examples that don't compile.
Addressing https://github.com/ethereum/solidity/issues/684
Diffstat (limited to 'docs')
-rw-r--r-- | docs/contracts.rst | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst index 190750f9..e7b71c3d 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -883,8 +883,8 @@ custom types without the overhead of external function calls: using BigInt for BigInt.bigint; function f() { - var x = bigint.fromUint(7); - var y = bigint.fromUint(uint(-1)); + var x = BigInt.fromUint(7); + var y = BigInt.fromUint(uint(-1)); var z = x.add(y); } } @@ -986,7 +986,7 @@ Let us rewrite the set example from the It is also possible to extend elementary types in that way:: library Search { - function indexOf(uint[] storage self, uint value) { + function indexOf(uint[] storage self, uint value) returns (uint) { for (uint i = 0; i < self.length; i++) if (self[i] == value) return i; return uint(-1); @@ -1004,8 +1004,8 @@ It is also possible to extend elementary types in that way:: function replace(uint _old, uint _new) { // This performs the library function call - uint index = data.find(_old); - if (index == -1) + uint index = data.indexOf(_old); + if (index == uint(-1)) data.push(_new); else data[index] = _new; |