Go Iota Simple use of iota

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

Example

To create a list of constants - assign iota value to each element:

const (
  a = iota // a = 0
  b = iota // b = 1
  c = iota // c = 2
)

To create a list of constants in a shortened way - assign iota value to the first element:

const (
  a = iota // a = 0
  b        // b = 1
  c        // c = 2
)


Got any Go Question?