Get the latest tech news
The Smallest Thing in Go
iota is a neat feature of Go that lets us create “enums”: lists of constants with arbitrary values. Let’s find out how to use iota, with this quick tutorial.
For example, suppose we’re writing an astronomy program, and we want to be able to distinguish between different kinds of night-sky objects: It’s a kind of magical, ever-increasing value we can use to assign arbitrary numbers to constants: By the way, you can put comments or blank lines in your constant block, and it won’t affect the values of iota:
Or read this on Hacker News