<p dir="auto">Python's for-else construct as described for example in section 4.4, <a href="https://docs.python.org/2/tutorial/controlflow.html" rel="nofollow">here</a>, is sometimes very useful.  (The idea is that the else clause will be executed after the loop completes normally, but not if we break out of the loop.)  Could something similar be added to Julia?</p>
<p dir="auto">As an example, code like:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="converged=true
for i=1:n
    if !isapprox(y[i],ynew[i])
        converged=false
        break
    end
end
if converged
    return y
end"><pre class="notranslate">converged<span class="pl-k">=</span><span class="pl-c1">true</span>
<span class="pl-k">for</span> i<span class="pl-k">=</span><span class="pl-c1">1</span><span class="pl-k">:</span>n
    <span class="pl-k">if</span> <span class="pl-k">!</span><span class="pl-c1">isapprox</span>(y[i],ynew[i])
        converged<span class="pl-k">=</span><span class="pl-c1">false</span>
        <span class="pl-k">break</span>
    <span class="pl-k">end</span>
<span class="pl-k">end</span>
<span class="pl-k">if</span> converged
    <span class="pl-k">return</span> y
<span class="pl-k">end</span></pre></div>
<p dir="auto">could become:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="for i=1:n
    if !isapprox(y[i],ynew[i])
        break
    end
else
    return y
end"><pre class="notranslate"><span class="pl-k">for</span> i<span class="pl-k">=</span><span class="pl-c1">1</span><span class="pl-k">:</span>n
    <span class="pl-k">if</span> <span class="pl-k">!</span><span class="pl-c1">isapprox</span>(y[i],ynew[i])
        <span class="pl-k">break</span>
    <span class="pl-k">end</span>
<span class="pl-k">else</span>
    <span class="pl-k">return</span> y
<span class="pl-k">end</span></pre></div>
<p dir="auto">Allow and else clause on for and while loops that executes if the loop never executes.</p>