Try this: // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; contract Jar { uint[][] m = [[4, 6], [5, 7]]; function fillMultidimensionalArray(uint _firstValue, uint _secondValue) public { // You must declare the array which will be inserted into the multidimensional array uint[] memory v = new uint[](2); // Then after initializing, you must populate the array v[0] = _firstValue; v[1] = _secondValue; // And here, you put the array 'v' into 'm' (multidimensional array) m.push(v); } function getV(uint _firstIndex, uint _secondIndex) public view returns (uint) { return m[_firstIndex][_secondIndex]; } }