const (
a = iota
b = iota
c = iota
)
출력값
0
1
2
const a = iota
const b = iota
const c = iota
출력값
0
0
0
const
로 묶어서 사용해야 한다.const
마다 iota가 새로 생성된다.const (
a = iota
b
c
)
출력값
0
1
2
const (
zero = "zero" // zero
one = iota // 1
two = "two" // two
three = iota // 3
)
const
에서 첫 번째 선언부터 0
이 카운트 된다.0
const (
mutexLocked = 1 << iota
mutexWoken // 1 << 1
mutexStarving // 1 << 2
mutexWaiterShift = iota
)
출력값
1
2
4
3
sync.Mutex
코드 참고.const (
zero = iota * iota
one
two
three
)
출력값
0
1
4
9
const (
iota = 0 // iota
zero = iota // iota
one // iota
two // iota
three // iota
)
출력값
0
0
0
0
iota
를 초기화 하는 경우 자동 increment가 사라진다.