1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| pragma solidity ^0.4.23;
contract twoArray{
uint[2] ericGrade = [40,20];
uint[2][3] grade = [[60,80],[40,20],[50,50]];
function getGrade() view public returns(uint[2][3]){
return grade; }
function getLength() view public returns(uint){
return grade.length; }
function getLength3() view public returns(uint){
return grade[0].length; }
function changeContent() public {
grade[0][1] = 100;
}
function add() view public returns(uint){ uint sum = 0; for(uint i = 0;i<3;i++){ for(uint j = 0;j<2;j++){ sum+= grade[i][j]; } } return sum; }
}
|