Yet another beginner\'s question for golang:
I can write:
for i := 0; i < 10; i++ {}
But if I want i to be of a spe
The language specification for a for loop states that: The init statement may be a short variable declaration, which is assignment of the form i := 0 but not a declaration of the form var i = 0. As for the reason behind this - I'm guessing language simplicity. See here: http://golang.org/ref/spec#For_statements
BTW You can do something like this:
for i := int64(0); i < 10; i++ {
// i here is of type int64
}