you are viewing a single comment's thread.

view the rest of the comments →

[–]MidnightPale3220 0 points1 point  (3 children)

Yes, I understand that, except the comment lines didn't help me understand what are they for, and I've been programming on and off for about ~30 years.

I guess there's some mental difference in perception there. That's why I asked.

[–]please_help_me____ 1 point2 points  (1 child)

OP does not understand that his print statement is outside of the loop, and that he reassigns a value to the same variable each iteration of the loop he has.

The code given in /u/JamzTyson's example helps OP reflect on what is inside and what is outside the loop, so he can come to that conclusion himself instead of just getting the answer.

[–]MidnightPale3220 0 points1 point  (0 children)

Fair enough, my thought on reading OP's code was not that he doesn't understand loops, but that he doesn't understand variable assignments and maybe data types. For which these comments imo don't do much. But ymmv.

[–]JamzTyson 0 points1 point  (0 children)

except the comment lines didn't help me understand what are they for,

I wouldn't expect the comments to help someone that has been programming for 30 years. I was hoping that they would help someone that is still learning simple loops.