Ethereum 以0.5.0的坚固度返回字符串。函数中返回参数的数据位置必须为“内存”
如何在0.5.0 solidity编译器版本中返回字符串Ethereum 以0.5.0的坚固度返回字符串。函数中返回参数的数据位置必须为“内存”,ethereum,solidity,smartcontracts,Ethereum,Solidity,Smartcontracts,如何在0.5.0 solidity编译器版本中返回字符串 contract Test { string public text = 'show me'; function test() public view returns (string) { return text; } } 我收到错误消息: TypeError: Data location must be "memory" for return parameter in function, bu
contract Test {
string public text = 'show me';
function test() public view returns (string) {
return text;
}
}
我收到错误消息:
TypeError: Data location must be "memory" for return parameter in function, but none was given.
只需在字符串后添加内存,如下所示:
function test() public view returns (string memory) {
其他变化:
只需在字符串后添加内存,如下所示:
function test() public view returns (string memory) {
其他变化: