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

     1  // An example of using Go's iota enumerator to model the year and city where the summer Olympics took place.
     2  package main
     3  
     4  import "fmt"
     5  
     6  func main() {
     7  
     8  	const (
     9  		LosAngeles = 1984 + (iota * 4)
    10  		Seoul
    11  		Barcelona
    12  		Atlanta
    13  		Sydney
    14  		Athens
    15  		Beijing
    16  		London
    17  		Rio
    18  		Tokyo
    19  	)
    20  
    21  	fmt.Println("These cities hosted or will host the Summer Olympics in the provided year...")
    22  	fmt.Printf("%-18s %-18s \n", "City", "Year")
    23  	fmt.Printf("%-18s %-18v \n", "Los Angeles", LosAngeles)
    24  	fmt.Printf("%-18s %-18v \n", "Atlanta", Atlanta)
    25  	fmt.Printf("%-18s %-18v \n", "Tokyo", Tokyo)
    26  
    27  }