In that case i belongs to the scope of the outer loop (thus a local scope).
The problem with the first one is that having a global i has a whole set of implications for type inference and performance (because i is global), and for that it has to be deal with differently.