for Beginners :: Loops allow you to execute a sequence of statements repeatedly, using a control condition or variable to determine when the execution stops. Delphi has three kinds of control loop: repeat statements, while statements, and for statements.
Read the full article to learn aboutLoops In Delphi
Related:

Nice article but I’m disapointed by the fact that you forgot to mention that improperly implemented lops are 2nd most comon reason for aplications to not run as expected (infinite loops).
Using for lop doesn’t pose risk for making infinite loop iunles you change your controll variable from whithin loop. This due to automatic contaoll variable handling (the for loop will increase or decrease this nimber itself.
But repeat…until and while…..do lops do pose great for making infinite loop.
One of the most comon mistakes from begginers is that they forgot to handle contraol variable by themself while using repeat or while loop (i := i+1). Doing this lop will never reach its finishing condition and thus it will an Infinite loop. I probably don’t have to mention that if this is executed in default program thread (main loop) it will cause fhe from to be unresponsive and look like application has frozen.
Another common mistake is waiting for wrong endeing parameter. For instance if you have some function which can return result as number between 1-10 it will be usles if you would have some loop which will be expecting 11 as a result from this function. Again doing so will create so caled infinite loop becouse ending condition will never be met.
For loop code blocks i always insert a safe check to stop the loop,
so the program run out of empty results that keep the loop section.
To do this,have a second or more condition at check is better,
then use the logic for what i call “safe checks”.
this way to have a different result or a default result,
can also work as ways to identify where and why are giving some issues with the program behavior.
@WDS,kte killer.
Could you please post a code example here for your solution? To be honest I don’t realy understand what you meant.
Simple use by example,
another variable that counts the loop.then stop it if no result after that.
i := 0;
while,for,…
…
inc(i);
if i = 3 then begin
break;
end;
end;