File r37/lisp/csl/html/r37_0056.html artifact 5968b08dc0 part of check-in 9992369dd3



<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>&lt;statement&gt; <em>until</em> &lt;condition&gt; 
<P>
<P>
<P>
&lt;statement&gt; 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>. &lt;condition&gt; must be 
a logical operator that evaluates to true or nil. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>
&lt;&lt;m := 4; repeat &lt;&lt;write 100*x*m;m := m-1&gt;&gt; until m = 0&gt;
&gt;;
			 


  400*X
  300*X
  200*X
  100*X



&lt;&lt;m := -1; repeat &lt;&lt;write m; m := m-1&gt;&gt; until m &lt;= 0&gt;
&gt;;
			 


  -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>


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]