Coding algorithms that go back to certain steps if condition fails in R : <p>I'm a beginner to programming and I want to code an algorithm that goes back to certain places in the algorithm if a condition fails. So for instance, if I have an algorithm like:</p>

<ol>
<li>Do something here</li>
<li>Check condition 1, else go back to 1.</li>
<li>Do something here</li>
<li>Check condition 2, else go back to 3.</li>
</ol>

<p>How do I go about coding a step 4 where if it fails I don't just completely start again but go back to a previous point of the function/algorithm?</p>

<p>Many thanks for any help!
Ryan</p>
