aah, yes, thats because the compiler isnt smart enough to know that the outer for loop will run at least once, so it doesnt see that would have happened
and one last tip, regarding the code when u declared and outside of the loops: its good practice to declare them close to where u use them, so in that case that would have been directly above for loops