08.控制语句break、continue、return
<h1>08.控制语句break、continue、return</h1>
<h2>1、break跳出整个循环,循环结束</h2>
<pre><code> for i in 1..4 {
if i == 2 {
break;
}
println!(&quot;{}&quot;, i);
}</code></pre>
<h2>2、continue</h2>
<p>继续下一次循环</p>
<pre><code> for i in 1..4 {
if i == 2 {
continue;
}
println!(&quot;{}&quot;, i);
}</code></pre>