Embarcadero Delphi Loops

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

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

Syntax

  • 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;


Got any Embarcadero Delphi Question?