I was trying Go on http://tour.golang.org/, and I saw that it was possible to declarate two times the same var using := in for loop. The output is the same with the Go compiler.
Here is my test : (see the var i, it was declared two times)
package main
import "fmt"
func main() {
i := "Hello"
a := 0
for a < 2 {
fmt.Println(i)
i := "World !"
fmt.Println(i)
a++
}
}
Output :
Hello
World !
Hello
World !
Can someone explain that ?