Embarcadero DelphiLoops


Delphi language provide 3 types of loop

for - iterator for fixed sequence over integer, string, array or enumeration

repeat-until - quit condition is checking after each turn, loop executing at minimum once tmeeven

while do - do condition is checking before each turn, loop could be never executed


  • for OrdinalVariable := LowerOrdinalValue to UpperOrdinalValue do begin {loop-body} end;
  • for OrdinalVariable := UpperOrdinalValue downto LowerOrdinalValue do begin {loop-body} end;
  • for EnumerableVariable in Collection do begin {loop-body} end;
  • repeat {loop-body} until {break-condition};
  • while {condition} do begin {loop-body} end;