go iota

package main

import (
    "fmt"
)

const (
    a = 'A'
    b
    c = iota
    d
)

func main() {
    fmt.Println(a)
    fmt.Println(b)
    fmt.Println(c)
    fmt.Println(d)
}

[ /dinglicom/gowork/project/test/ ] # go run test1.go

[ `go run test1.go` | done: 641.241905ms ]

65

65

2

3

以定义常量的顺序次数有关系,

递增加1,再每个常量表达式组会初始化重新计数