1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/try-again.R
\name{try_again}
\alias{try_again}
\title{Try evaluating an expressing multiple times until it succeeds.}
\usage{
try_again(times, code)
}
\arguments{
\item{times}{Maximum number of attempts.}
\item{code}{Code to evaluate}
}
\description{
Try evaluating an expressing multiple times until it succeeds.
}
\examples{
third_try <- local({
i <- 3
function() {
i <<- i - 1
if (i > 0) fail(paste0("i is ", i))
}
})
try_again(3, third_try())
}
\keyword{internal}
|