github.com/iotexproject/iotex-core@v1.14.1-rc1/tools/executiontester/blockchain/array-delete-passing.sol (about)

     1  pragma solidity 0.4.24;
     2  contract A {
     3      uint256[] public numbers;
     4      function A(uint256[] _numbers) {
     5          for(uint256 i=0; i<_numbers.length; i++) {
     6              numbers.push(_numbers[i]);
     7          }
     8      }
     9  
    10      function get() returns (uint256[]) {
    11          return numbers;
    12      }
    13  }
    14  
    15  contract Manager {
    16      uint[] numbers;
    17      function makeA() returns (uint256) {
    18          uint256[] numbers;
    19          numbers.push(10);
    20  
    21          A a = new A(numbers);
    22  
    23          return a.numbers(0);
    24      }
    25      function getArray() returns (uint[]) {
    26              numbers.push(100);
    27              numbers.push(200);
    28              numbers.push(300);
    29              numbers.push(400);
    30              numbers.push(500);
    31  
    32              delete numbers[2];
    33  
    34              // 100, 200, 0, 400, 500
    35              return numbers;
    36          }
    37  }