Link to home
Start Free TrialLog in
Avatar of Delphi_developer
Delphi_developer

asked on

How to debug For loops?

I use a lot of For loops and when I need to debug what is going on - step-by-step execution within the for loop,  I use break-point like this:

For i:=a to b do
begin
  ...
  if i=541 then
    sleep(0); <- this is the line with (F5) break-point to so I can analyze execution when i = 541
  ...
end;

Is there any other way, it is annoying when I need to add the code and breakpoint and recompile and run again.
I see there are options on Breakpoint Properties with Condition, Thread, Pass count, Group values.
I tried to set Pass count to 541 or Condition to i=541, but nothing worked on simple break-point on any line, without sleep(0);

Is there any easy way to do this?
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Delphi_developer
Delphi_developer

ASKER

Well, now the Condition works! Was trying the same thing yesterday, but didn't work. I guess it was one of those days, Sunday.
Thank you also for quick logging example.