go-ethereum/contracts/solidity_0.6/array_resizing.sol
olumuyiwadad b5abbfed79 new EVM Upgrade
- Solidity Upgraded up to v0.8.0
-  Fixed and Added eth_chainId
- Fix error in TransactionRecipet
- Reward halving issue fixed
2021-09-21 16:53:46 +05:30

15 lines
539 B
Solidity

pragma solidity ^0.6.0;
contract Test {
string[] public names_A_to_F;
function test() public {
// invalid syntax
uint length = names_A_to_F.push("Alice"); // invalid
names_A_to_F.length++; // invalid as length is now read only
// correct syntax
names_A_to_F.push(); // increase array length
names_A_to_F.push("Alice"); // add item to array
names_A_to_F.pop(); // reduce array length by removing item
uint length = names_A_to_F.length; // access array length
}
}