Constants name values that do not change, and iota can count related constants.

Constants and Iota

constants_iota.go
package main

import "fmt"

const (
	StatusNew = iota
	StatusActive
	StatusDone
)

func main() {
	var status = 
	label := ""

	if status == StatusNew {
		label = "new"
	} else if status == StatusActive {
		label = "active"
	} else {
		label = "done"
	}

	fmt.Println("status=", status)
	fmt.Println("label=", label)
}
package main

import "fmt"

const (
	StatusNew = iota
	StatusActive
	StatusDone
)

func main() {
	var status = 
	label := ""

	if status == StatusNew {
		label = "new"
	} else if status == StatusActive {
		label = "active"
	} else {
		label = "done"
	}

	fmt.Println("status=", status)
	fmt.Println("label=", label)
}
package main

import "fmt"

const (
	StatusNew = iota
	StatusActive
	StatusDone
)

func main() {
	var status = 
	label := ""

	if status == StatusNew {
		label = "new"
	} else if status == StatusActive {
		label = "active"
	} else {
		label = "done"
	}

	fmt.Println("status=", status)
	fmt.Println("label=", label)
}
iota Inside a Go constant block, `iota` starts at zero and increases by one on each line.