aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-05 22:19:16 +0800
committerGitHub <noreply@github.com>2018-04-05 22:19:16 +0800
commitd74b71a554395de42ee53ce1d16a03b7cef3fd92 (patch)
tree2be0f81e063461b689c89009a31955aa2220c743
parent4c50ed39d76c4bd96ed73f40077da2c3f6d13c35 (diff)
parentd662622b25ab737887d0c002aec76fc3bbbaf909 (diff)
downloaddexon-solidity-d74b71a554395de42ee53ce1d16a03b7cef3fd92.tar
dexon-solidity-d74b71a554395de42ee53ce1d16a03b7cef3fd92.tar.gz
dexon-solidity-d74b71a554395de42ee53ce1d16a03b7cef3fd92.tar.bz2
dexon-solidity-d74b71a554395de42ee53ce1d16a03b7cef3fd92.tar.lz
dexon-solidity-d74b71a554395de42ee53ce1d16a03b7cef3fd92.tar.xz
dexon-solidity-d74b71a554395de42ee53ce1d16a03b7cef3fd92.tar.zst
dexon-solidity-d74b71a554395de42ee53ce1d16a03b7cef3fd92.zip
Merge pull request #3805 from kevinflo/tuple-documentation-var-removal
Removed documentation reference to var for tuple variable assignment
-rw-r--r--docs/control-structures.rst10
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index 46e076e5..40070a20 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -284,10 +284,12 @@ Solidity internally allows tuple types, i.e. a list of objects of potentially di
}
function g() public {
- // Declares and assigns the variables. Specifying the type explicitly is not possible.
- var (x, b, y) = f();
- // Assigns to a pre-existing variable.
- (x, y) = (2, 7);
+ // Variables declared with type
+ uint x;
+ bool b;
+ uint y;
+ // Tuple values can be assigned to these pre-existing variables
+ (x, b, y) = f();
// Common trick to swap values -- does not work for non-value storage types.
(x, y) = (y, x);
// Components can be left out (also for variable declarations).