Hey,

someone shared [this question](
https://www.reddit.com/r/golang/comments/6paqc0/bug_that_caught_me_with_range/)
on reddit. I must say, that I'm surprised by the behavior myself. I would
have expected
for i = range v
to be semantically equivalent to
for i = 0; i < len(v); i++
and don't really understand the reasoning behind choosing different
semantics. Note, that the difference only exists, if i is declared outside
of the loop, that is, this is solely about the behavior after exiting the
loop-body.

I'd greatly appreciate some explanation :)

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to