solidity学習ノート(一)


列挙タイプテスト
pragma solidity ^0.4.16;
/**
 * The enumtt contract does that  
   :  :
  1.   visibility( public );
  2.  
     multability(view: constant; pure:constant  )
  3. , empty(void)
     returns 。
 */
contract enumtt {
    event e(uint _a);
    enum GoAction { GoLeft, GoRight, GoStraight }
    GoAction ga;
    GoAction constant defaultAction  = GoAction.GoStraight;

    function setGoRight () public {
        ga = GoAction.GoRight;      
    }
    function getGoAction () public view returns (GoAction){
        return ga;
    }

    function getDefaultAction() public pure returns (uint){
        return uint(defaultAction);
    }


    function enumtt () public {
        e(uint(defaultAction));         
    }   
}