其他分享
首页 > 其他分享> > go iota

go iota

作者:互联网

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

标签:01,fmt,Println,go,main,iota
来源: https://www.cnblogs.com/brady-wang/p/15265199.html