github.com/EngineerKamesh/gofullstack@v0.0.0-20180609171605-d41341d7d4ee/volume1/section2/trafficlights/trafficlights.go (about)

     1  // An example of declaring a constant grouping with an iota enumerator.
     2  package main
     3  
     4  import (
     5  	"fmt"
     6  )
     7  
     8  const (
     9  	_ = iota
    10  	TrafficLightStateRedLight
    11  	TrafficLightStateGreenLight
    12  	TrafficLightStateYellowLight
    13  )
    14  
    15  func main() {
    16  
    17  	fmt.Println("Red Light State Code: ", TrafficLightStateRedLight)
    18  	fmt.Println("Green Light State Code: ", TrafficLightStateGreenLight)
    19  	fmt.Println("Yellow Light State Code: ", TrafficLightStateYellowLight)
    20  }