December 2018
Intermediate to advanced
222 pages
6h 6m
English
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); }}
Read now
Unlock full access