Enum type

Enum is a type with a restricted set of constants values. Here is an example, as follows:

pragma solidity ^0.4.24;
contract ColorEnum {
enum Color {RED,ORANGE,YELLOW, GREEN}
Color color;
function construct() public {
color = Color.RED;
}
function setColor(uint _value) public {
color = Color(_value);
}
function getColor() public view returns (uint){
return uint(color);
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.94.213