<A NAME=REPEAT>
<TITLE>REPEAT</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>
<B>REPEAT</B> _ _ _ _ _ _ _ _ _ _ _ _ <B>command</B><P>
<P>
<P>
<P>
The
<A HREF=r37_0056.html>repeat</A> command causes repeated execution of a statemen
t
<em>until</em><P>
<P>
the given condition is found to be true. The statement is always executed
at least once.
<P> <H3>
syntax: </H3>
<P>
<P>
<em>repeat</em><statement> <em>until</em> <condition>
<P>
<P>
<P>
<statement> can be a single statement,
<A HREF=r37_0038.html>group</A> statement, or
a <em>begin</em>...<em>end</em>
<A HREF=r37_0041.html>block</A>. <condition> must be
a logical operator that evaluates to true or nil.
<P>
<P>
<P> <H3>
examples: </H3>
<P><PRE><TT>
<<m := 4; repeat <<write 100*x*m;m := m-1>> until m = 0>
>;
400*X
300*X
200*X
100*X
<<m := -1; repeat <<write m; m := m-1>> until m <= 0>
>;
-1
</TT></PRE><P><em>repeat</em>must always be followed by an <em>until</em> with a
condition.
Be careful not to generate an infinite loop with a condition that is never
true. In the second example, if the condition had been <em>m = 0</em>, it
would never have been true since <em>m</em> already had value -2 when the
condition was first evaluated.
<P>
<P>
<P>