Merge pull request #3805 from kevinflo/tuple-documentation-var-removal

Removed documentation reference to var for tuple variable assignment
This commit is contained in:
chriseth 2018-04-05 16:19:16 +02:00 committed by GitHub
commit d74b71a554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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).