Hi, I have below code, but as per my understanding “aaa” in first const block should be 0 when we first assign iota, where in this case its 3, and bbb is 4 since its starting at 3 because we already have 3 constants in first const block(0,1,2) for a, pi,&str1; is this expected and right-way? I thought it should start with 0 whenever we declared first time in const block. or I’m missing anything! Thank you
package main
import “fmt”
const(
a=35
pi=3.79879889
str1=“Jangalapalli”
aaa=iota
bbb
)
const (
aaa1=iota
bbb1
ccc1
ddd1
)
func main() {
fmt.Printf(“Value: %v\t type:%T\n”,a,a)
fmt.Printf(“Value: %v\t type:%T\n”,pi,pi)
fmt.Printf(“Value: %v\t type:%T\n”,str1,str1)
fmt.Printf("Value: %v\t type:%T\n",aaa,aaa)
fmt.Printf("Value: %v\t type:%T\n",bbb,bbb)
fmt.Printf("Value: %v\t type:%T\n",aaa1,aaa1)
fmt.Printf("Value: %v\t type:%T\n",bbb1,bbb1)
fmt.Printf("Value: %v\t type:%T\n",ccc1,ccc1)
fmt.Printf("Value: %v\t type:%T\n",ddd1,ddd1)
}
Thanks,
Subbareddy Jangalapalli