chapter10-code-1

PHOTO EMBED

Thu Mar 30 2023 10:01:16 GMT+0000 (Coordinated Universal Time)

Saved by @RareSkills

contract ExampleContract {

	uint256[] public myArray;

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

	function addToArray(uint256 newItem) public {
		myArray.push(newItem);
	}

	function removeFromArray() public {
		myArray.pop();
	}

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

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