Equal opeartor not working with Array in Solidty
I wrote a simple solidity programme:-
//SPDX-License-Identifier: MIT
pragma solidity 0.8.16 ;
contract arr
{ uint256[] public n ;
uint256 x = 0 ;
function pl(uint256 a ) public
{
n[x] = a ;
x++ ;
}
}
It is showing below error
Error showing image while calling function
It reads that
The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information.
I am new to solidity. Can anyone please explain it to me that why = opearator is not working with arrays. I read that Solidity is similar to Javascript & in Jsp it is working fine ?
Comments
Post a Comment