i is overwritten in this Java construct? Interesting. I'm only (a little) familiar with Lua and Python and both would treat the two i variables as distinct local variables.
Python:
text = ""
for i in range(3):
text += "\n{}: ".format(i)
for i in range(2):
text += "{} ".format(i)
else:
print(text)
outputs:
0: 0 1
1: 0 1
2: 0 1
Lua:
text = ""
for i = 0,2 do
text = text.."\n"..tostring(i)..": "
for i = 0,1 do
text = text..tostring(i).." "
end
end
print(text)
outputs:
0: 0 1
1: 0 1
2: 0 1