Sunday, October 17, 2021

solidity 1


compiler

deploy
//counter.sol

pragma solidity ^0.6.0;

contract Counter{
    uint count;
    
    constructor() public{
        count = 1;
    }
    
    function getCount() public view returns(uint){
        return count;
    }
    
    function incrementCount() public{
        count = count + 1;
    }
}

---------------------------
//easier counter.sol

pragma solidity ^0.6.0;

contract Counter{
    uint public count = 1;
    
    function incrementCount() public{
        count++;
    }
}

reference:

No comments:

Post a Comment