File r37/lisp/csl/html/r37_0131.html artifact 01845011d1 part of check-in 5f584e9b52



<A NAME=REDERR>

<TITLE>REDERR</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>



<B>REDERR</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>command</B><P>
<P>
 
 <P>
<P>
The <em>rederr</em> command allows you to print an error message from inside 
a 
<A HREF=r37_0055.html>procedure</A> or a 
<A HREF=r37_0041.html>block</A> statement. 
The calculation is gracefully terminated. 
 <P> <H3> 
syntax: </H3>
<P>
<P>
<em>rederr</em>&lt;message&gt; 
<P>
<P>
<P>
&lt;message&gt; is an error message, usually inside double quotation marks 
(a 
<A HREF=r37_0003.html>string</A>). 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>
procedure fac(n);
   if not (fixp(n) and n&gt;=0)
     then  rederr &quot;Choose nonneg. integer only&quot;
    else for i := 0:n-1 product i+1;
 

  fac 


fac a; 

  	   ***** Choose nonneg. integer only 


fac 5; 

  120

</TT></PRE><P>The above procedure finds the factorial of its argument. 
If n is not a positive integer or 0, an error message is returned. 
<P>
<P>
If your procedure is executed in a file, the usual error message is 
printed, followed by <em>Cont? (Y or N)</em>, just as any other error does from 

a file. Although the procedure is gracefully terminated, any switch settings or 

variable assignments you made before the error occurred are not undone. If you 
need to clean up such items before exiting, use a group statement, with the 
<em>rederr</em> command as its last statement. 
<P>
<P>
<P>


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