solidity 学习笔记 2 (二维数组)
solidity 二维数组:
pragma solidity ^0.4.23;
contract twoArray{
uint[2][3] grade =[[20,30],[40,50],[45,60]]; //定义一个二维数组
function getGrade() view public returns(uint[2][3]){
return grade;
}
//获取二维数组总长度
function getLength() public view returns (uint){
return grade.length;
}
//获取维度
function getLength2() public view returns (uint){
return grade[0].length;
}
//修改二维数组中的值
function changeContent() public {
grade[0][1] = 10;
}
}