Difference between revisions of "Repeat"

From Lazarus wiki
Jump to navigationJump to search
(Repeat does not need "begin" and "end;" and therefore deleted.)
Line 17: Line 17:
 
   '''x := 1;'''
 
   '''x := 1;'''
 
   '''repeat'''
 
   '''repeat'''
  '''begin'''
 
 
   '''  DoSomethingHere(x);'''
 
   '''  DoSomethingHere(x);'''
 
   '''  x := x + 1;'''
 
   '''  x := x + 1;'''
  '''end;'''
 
 
   '''until x = 10;'''
 
   '''until x = 10;'''
  

Revision as of 06:11, 23 February 2014

Template:repeat
This keyword is used in a control construct that is similar to a while do loop.

Syntax:

 repeat
   <statement block>
 until <condition>;

<statement block>: A single pascal statement or a begin-end statement block.

<condition>: Expression that eveluates to a boolean value.

Example:

 x := 1;
 repeat
   DoSomethingHere(x);
   x := x + 1;
 until x = 10;



Keywords: begindoelseendforifrepeatthenuntilwhile