HelloWorld for getting started with writing smart contracts using Remix

pragma solidity ^0.4.16;

// 对象
contract HelloWorld{
    string Myname = "zifuchuan";
    
    function getName() public view returns(string){
        return Myname;
    }
}

important point

  1. pragma solidity ^0.4.16; The definition version. In many old tutorials, the version number set is 0.4.0. This will cause a problem. An
    error is reported Expected token LBrace got ‘View‘ function getMessage(). At first, it was a pit. After reading this blog, I jumped out of the pit.
  2. On the right side, you need to select the correct compiled version, select >=0.4.16, and the version less than 0.5
    Insert picture description here
  3. The reference tutorial is the most clicked development tutorial on station B: Ethereum-based smart contract development tutorial [Solidity]

Guess you like

Origin blog.csdn.net/weixin_39333120/article/details/112337461