mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update documentation.
This commit is contained in:
parent
8ee5d3b274
commit
741ada79f9
@ -293,12 +293,7 @@ Solidity internally allows tuple types, i.e. a list of objects of potentially di
|
|||||||
// 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).
|
||||||
// If the tuple ends in an empty component,
|
(data.length,,) = f(); // Sets the length to 7
|
||||||
// the rest of the values are discarded.
|
|
||||||
(data.length,) = f(); // Sets the length to 7
|
|
||||||
// The same can be done on the left side.
|
|
||||||
// If the tuple begins in an empty component, the beginning values are discarded.
|
|
||||||
(,data[3]) = f(); // Sets data[3] to 2
|
|
||||||
// Components can only be left out at the left-hand-side of assignments, with
|
// Components can only be left out at the left-hand-side of assignments, with
|
||||||
// one exception:
|
// one exception:
|
||||||
(x,) = (1,);
|
(x,) = (1,);
|
||||||
@ -307,6 +302,11 @@ Solidity internally allows tuple types, i.e. a list of objects of potentially di
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Prior to version 0.4.24 it was possible to assign to tuples of smaller size, either
|
||||||
|
filling up on the left or on the right side (which ever was empty). This is
|
||||||
|
now deprecated, both sides have to have the same number of components.
|
||||||
|
|
||||||
Complications for Arrays and Structs
|
Complications for Arrays and Structs
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user