for loop is counting backwards
Posted on 2000-04-04
Consider the following code:
procedure TFormMain.ButtonReJARClick(Sender: TObject);
counter1 : integer;
FileFailed : boolean;
temp1 : string;
temp2 : string;
temp1 := PathToFileToAdd;
temp2 := JARFileCandidates.GetFilePath;
FileFailed := false;
for counter1 := 2 to 40 do
if JARFileCandidates[counter1].GetReplaceStatus = true then
CopyFile(pchar(PathToFileToAdd), pchar(JARFileCandidates[counter1].GetFilePath), FileFailed);
As I step through this code in the debugger, counter1 is STARTING at 40 and counting BACKWARDS but I am not using "down to" in my for loop.
Can anyone explain this strange behavior to me?