Storage array push and pop
Append, update, and remove values from a dynamic storage array.
Solidity 0.8.36REPL mode
Why use this example
Use this pattern to explore how Solidity represents typed values and how state-changing expressions affect storage. The entry isolates storage array push and pop so its input, result, and state changes stay easy to compare.
Solidity to run
uint256[] public values
values.push(10)
values.push() = 20
uint256 removed = values[1]
values.pop()
removed
values.length
values[0]Official Solidity reference
Compare this focused investigation with the complete language definition in the Solidity documentation.
Array membersWhat to expect
The removed value remains 20 while the storage array shrinks to one item containing 10.
Continue the investigation
Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.
Read about state and storage Reproducible investigation