egor-belikov's blog

By egor-belikov, 13 years ago, translation, In English

Question is only for Delphi- and Pascal-programmers.

Maybe, not only I have, when loop-variable was capricious. Example:

for i := 1 to n do

  writeln('Spam-spam-spam');

"i" is going from n + 1 downto 2. Or in other order, unknown for me and debugger.

How can it cure?

  • Vote: I like it
  • 0
  • Vote: I do not like it

13 years ago, # |
  Vote: I like it +1 Vote: I do not like it
It isn't a normal behaviour...

But, why "unknown for me and debugger"? Just try for i:=1 to n do writeln(i);
This suffices to check the correct behaviour of the loop.

Also you should check if you do something with "i" inside the loop.