pragma solidity ^0.4.21; contract HelloEthereum { string public msg1; string private msg2; address public owner; uint8 private counter; // constructor function HelloEthereum(string _msg1) public { msg1 = _msg1; owner = msg.sender; counter = 0; } // ownerのみがmsg2をセットできるようにする function setMsg2(string _msg2) public { if(owner != msg.sender) { revert(); } else { msg2 = _msg2; } } function getMsg2() view public returns(string) { return msg2; } function setCounter() public { for(uint8 i = 0; i < 3; i++) { counter++; } } function getCounter() view public returns(uint8) { return counter; } }
0.4.21