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;
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter