Embarcadero Delphi Tutorial:

Embarcadero Delphi Loops

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;

Embarcadero Delphi Loops Examples:

Related Embarcadero Delphi Tutorial Topics:

Other Tutorial Topics:

This modified content is an extract of the original Stack Overflow Documentation released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow. This topic was created and modified by the Stack Ovedrflow Contributor.