solidity基础-数组和枚举
数组
例子
contract ArrayTest {
uint256[] public array01;
uint256[] public array02=[1,2,3];
function push(uint256 i) public{
array01.push(i);
}
function pop(uint256 i) public{
array01.push(i);
}
function getArray() public view returns(uint256[] memory) {
return array02;
}
}
部署
枚举
例子
contract EnumTest { enum Numbers{ first, second } Numbers public num; function get() public view returns(Numbers){ return num; } function set(Numbers _num) public{ num = _num; } }
输出