solidity 出现错误:TypeError: Data location must be "memory" for return

pragma solidity >=0.4.0 <0.7.0;
contract HelloWorld{
    string public stateVariable = "Hello World";
    int int1;

   function GetHelloWorld() public view returns (string  _hello){
        _hello=stateVariable;
    }

}

solidity编译出现: TypeError: Data location must be "memory" for return parameter in function, but none was given.

请先 登录 后评论

2 个回答

zhou
请先 登录 后评论
jc0803kevin - 合约开发/区块链开发/项目管理
请先 登录 后评论
  • 2 关注
  • 0 收藏,2811 浏览
  • zhou 提出于 2020-10-17 19:06