Demo2

pragma solidity ^0.4.24;
contract MyContract{
string value;

constructor() public{
value = "myValue";
}

function get() public view returns(string) {
return value;
}

function set(string _value) public{
value = _value;
}

}

pragma solidity 0.5.1;

// contract MyContract{
// string public constant value = "value";
// bool public myBool = true;
// int public myInt = -1;
// uint public myUint = 1;

// uint8 public myUint8 = 255;//0~255

// }

contract MyContract{
enum State {Wating,Ready,Active} //枚举后面不要跟;
State public state;

constructor() public {
    state = State.Wating;
}

function active() public {
    state = State.Active;
}

function isActive() public view returns(bool) {
    return state == State.Active;
}

}

你可能感兴趣的:(Demo2)