package main import "fmt" const ( a = iota b = iota ) const ( name = "menglu" c = iota d = iota ) func main() { fmt.Println(a) fmt.Println(b) fmt.Println(c) fmt.Println(d) }
输出 还以为是 01 01 没想到
╭─mac@macdeMacBook-Pro ~/www/go/im ‹master*›
╰─$ go run main.go
0
1
1
2