mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Removed documentation reference to the now-depricated var tuple variable assignment syntax
This commit is contained in:
parent
be261ed519
commit
884ea39d85
@ -284,10 +284,12 @@ Solidity internally allows tuple types, i.e. a list of objects of potentially di
|
|||||||
}
|
}
|
||||||
|
|
||||||
function g() public {
|
function g() public {
|
||||||
// Declares and assigns the variables. Specifying the type explicitly is not possible.
|
// Variables declared with type
|
||||||
var (x, b, y) = f();
|
uint x;
|
||||||
// Assigns to a pre-existing variable.
|
bool b;
|
||||||
(x, y) = (2, 7);
|
uint y;
|
||||||
|
// These pre-existing variables can then be assigned to the tuple values
|
||||||
|
(x, b, y) = f();
|
||||||
// Common trick to swap values -- does not work for non-value storage types.
|
// Common trick to swap values -- does not work for non-value storage types.
|
||||||
(x, y) = (y, x);
|
(x, y) = (y, x);
|
||||||
// Components can be left out (also for variable declarations).
|
// Components can be left out (also for variable declarations).
|
||||||
|
Loading…
Reference in New Issue
Block a user