Rev 7002 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{restart}\title{Restart an Expression}\usage{restart(on = TRUE)}\arguments{\item{on}{if true a jump point is set; if false the jump point is removed}}\alias{restart}\description{\code{restart} performs a type of non-local return.}\details{When \code{restart} is called with \code{on = TRUE} the evaluator marks thatfunction as a return point. Any errors or signals (such as control-C onUnix) cause control to return to the start of the function containing thecall to \code{restart}. The most recently established function is alwaysentered first.}\note{Use of this code is likely to result in an infinite loop. It should beavoided if possible and is included in \R for compatibility with S. Theplanned \R exception handling should remove all need for such a function.}% and we have this, and restart is still here! BDR 99/12/14\examples{f <- function(x, first = TRUE){restart(first)if( first ) {first <- FALSEreturn(log(x))}elsereturn(NA)}f("a")}\keyword{programming}