特殊的枚举声明

| 阅读:223 发表时间:2016-12-03 20:23:21 Golang

```

package main

import "fmt"

//const (
// A = 0
// B = 1
// C = 2
//)

const (
A = iota
B
C
D
)

type Color int

const (
Red Color = iota
Blue
Yellow
)

func main() {
fmt.Println(A, B, C)

var Y int32 = 1
fmt.Println(Y + B)

fmt.Println(Red, Blue, Yellow)
}

```

热门推荐

友情连接

0.0234s