> What is the value of i ??

0, because `for i` implicitly declares a new variable `i`. You could perhaps 
argue that you should have to explicitly say `for let i`, but that seems 
pointless because the `let` would always be necessary. (Well, unless you did a 
`for case` or `for _`, but those are rare constructs.)

> My suggestion is to use the variable i in the loop instead of making hidden 
> init of another "i" for the loop. 

That seems like an extremely bad idea. What if the loop variable is a property 
or global and you accidentally end up using it implicitly? That's *way* worse 
than shadowing the outer variable.

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to