You may have noticed in our section about arrays we curiously left off

This is because you very rarely do that to arrays that are supplied as function arguments.

However, when arrays are in storage, this operation is more common.

Here’s some example code

contract ExampleContract {

	uint256[] public myArray;

	function setMyArray(uint256[] calldata newArray) public {
		myArray = newArray;

	function addToArray(uint256 newItem) public {

	function removeFromArray() public {

	function getLength() public view returns (uint256) {
		return myArray.length;

	function getEntireArray() public view returns (uint256[] memory) {
		return myArray;

I recommend you copy and paste this code into remix so you can gain an intuition for what is happening.

Call setArray with [1,2,3,4,5,6]

Now call getLength() it returns 6, which is the length of the array.

Now call addToArray with argument 10. Call getLength() again. Now it returns 7.