mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
24 lines
482 B
Solidity
24 lines
482 B
Solidity
|
contract c {
|
||
|
uint[20] spacer;
|
||
|
uint[] dynamic;
|
||
|
function fill() public {
|
||
|
for (uint i = 0; i < 21; ++i)
|
||
|
dynamic.push(i + 1);
|
||
|
}
|
||
|
function halfClear() public {
|
||
|
while (dynamic.length > 5)
|
||
|
dynamic.pop();
|
||
|
}
|
||
|
function fullClear() public { delete dynamic; }
|
||
|
}
|
||
|
// ====
|
||
|
// compileViaYul: also
|
||
|
// ----
|
||
|
// storage: empty
|
||
|
// fill() ->
|
||
|
// storage: nonempty
|
||
|
// halfClear() ->
|
||
|
// storage: nonempty
|
||
|
// fullClear() ->
|
||
|
// storage: empty
|