Repeat Statement

The repeat statement executes until the condition becomes true. The syntax of the repeat statement is:

repeat statement until expression

statement is executed repeatedly as long as expression evaluates false. The expression is evaluated after each iteration, so the loop will execute statement at least once.

Here is an example of calculating scalar product of two vectors, using the repeat statement:

s := 0; i := 0;
...
repeat
  begin
    s := s + a[i] * b[i];
    i := i + 1;
  end;
until i = n;
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code