pragma solidity ^0.5.1;
contract HelloWord{
string public name= "zhuxing";
//這里的memory是說要給返回參數(shù)確定所在位置,不給會提示錯誤
function getName() view public returns( string memory){
return name;
}
//這里的memory也是
function setName(string memory _name ) public {
name=_name;
}}
不加會提示錯誤如下: