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