// 07 Enumeration
package main
import (
"fmt"
)
func main() {
// 1.iota constant generated automatically, each row automatically accumulate 1
// 2.iota assigned to the constant use
const (
a = iota // 0
b = iota // 1
c = iota // 2
)
fmt.Printf("a = %d,b = %d,c = %d\n", a, b, c)
// 3.iota encountered const, will be reset to 0
const d = iota
fmt.Printf("d = Î%d\n", d)
// 4. You can write only one iota, effects same as above
const (
a1 = iota // 0
b1
c1
)
fmt.Printf("a1 = %d,b1 = %d,c1 = %d\n", a1, b1, c1)
// 5. If the same line, the values are the same
const(
i = iota
J1 , j2 , J3 = the IOTA , the IOTA , the IOTA // same row are 1
k = iota
)
fmt.Printf("i=%d,j1=%d,j2=%d,j3=%d,k=%d\n", i, j1, j2, j3, k)
}