pragma solidity ^0.5.8;
contract HelloWorld {
function test() pure returns (string) {
return "HelloWorld";
}
}
1 Answer
Assuming that you have the right compiler version (use a different one if needed) you are missing a few keywords from the function: public
to denote that the function is accessible everywhere and memory
to denote that the string is loaded from memory - string parameters have to be loaded from memory.
So the corrected version is:
function test() public pure returns (string memory) {
return "HelloWorld";
}
-
i am sorry do you know how to correct this code for the ^0.5.8 compiler , function balanceOf(address _owner) constant returns(uint256){ return balances[_owner]; } thx– YwDAug 20, 2019 at 14:17
-
public
/private
/external
/internal
)?