【发布时间】:2022-11-22 15:25:38
【问题描述】:
//When I compile and deploy below code. It gives me no error
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract MultipleValues{
function returnValues() public pure returns (uint, bool, uint8[3] memory) {
return (23, true, [1,2,3]);
}
}
//But when I change value from uint8[3] to uint[3] then it throws error
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract MultipleValues{function returnValues() public pure returns (uint, bool, uint[3] memory) {
return (23, true, [1,2,3]);
}
}
//how to resolve this issue?
//Unexpected behaviour of array in solidity when returning a fixed size array
【问题讨论】:
标签: arrays blockchain ethereum solidity smartcontracts