Iota


Iota Behavior

So, I bumped into a weird behavior with iota in Go that I wasn’t expecting, thought I’d document it here so that I’d find my own blog post next time I searched on it. (Isn’t that how it always works?) package main import ( "fmt" ) const ( STUFF = "STUFF" a0 = iota a1 a2 ) func main() { fmt.Printf("STUFF=%v, a0=%d, a1=%d, a2=%d",STUFF, a0, a1, a2) } With the above code, what is the value of a1?