1package main2 3import "fmt"4 5func firstConsts() {6 const (7 a = iota8 b = iota9 c = iota10 )11 12 fmt.Println(a, b, c)13}14 15func groupedConsts() {16 const (17 x, y, z = iota, iota, iota18 )19 20 fmt.Println(x, y, z)21}22 23func mixedConsts() {24 const (25 m byte = iota26 n27 o28 )29 30 const (31 e = iota32 f33 g34 )35 36 fmt.Println(e, f, g)37}38 39func main() {40 firstConsts()41 groupedConsts()42 mixedConsts()43}
Сначала подумай без запуска — на собесе компилятора не будет.