Name

Repeat Keyword

Syntax

repeat
  Statements...
until Boolean expression

Description

Delphi’s repeat statement works the same way as that of standard Pascal. The Statements are executed repeatedly until the Boolean expression is True.

Tips and Tricks

  • The Statements always execute at least once.

  • You don’t need begin and end to define a block because the repeat and until keywords delimit the statement list.

Example

if FindFirst(Path, faAnyFile, Search) = 0 then
try
  repeat
    MungFile(Path + Search.Name);
  until FindNext(Search) <> 0;
finally
  FindClose(Search);
end;

See Also

Boolean Type, Break Procedure, Continue Procedure, For Keyword, Until Keyword, While Keyword

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.