<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script> </head> <body> <h1>Continue</h1> <p>跳过当前<a href="../Language.htm#loop-statement">循环语句</a>的剩余部分并继续下一次循环.</p> <pre class="Syntax"><span class="func">Continue</span> <span class="optional">LoopLabel</span></pre> <h2 id="Parameters">参数</h2> <dl> <dt>LoopLabel</dt> <dd> <dd><em>LoopLabel</em> 标识了该语句应该应用于哪个循环; 这是通过<a href="../misc/Labels.htm">标签名</a>或嵌套层级的数值来实现的. 如果省略或为 1, 此语句应用于它所在的最内层循环. 如果指定了<a href="../misc/Labels.htm">标签</a>, 则它必须直接指向<a href="../Language.htm#loop-statement">循环语句</a>.</p> <p><em>LoopLabel</em> 必须为常量, 不支持变量和表达式, 但括号中的单个原义数字或用圆括号括起来的字符串除外, 例如: <code>continue("outer")</code>.</p> </dd> </dl> <h2 id="Remarks">备注</h2> <p>Continue 的行为如同直接到达了循环的闭括号:</p> <ol> <li>它让 <a href="../Variables.htm#Index">A_Index</a> 加 1.</li> <li>它跳过了循环体的剩余部分.</li> <li>检查循环条件(如果有) 判断是否满足. 如果满足, 开始新的循环; 否则循环结束.</li> </ol> <p>鼓励使用 <a href="Break.htm">Break</a> 和 Continue 代替 <a href="Goto.htm">Goto</a> 因为它们通常让脚本更容易阅读和维护.</p> <h2 id="Related">相关</h2> <p><a href="Break.htm">Break</a>, <a href="Loop.htm">Loop</a>, <a href="Until.htm">Until</a>, <a href="While.htm">While-loop</a>, <a href="For.htm">For-loop</a>, <a href="Block.htm">区块</a>, <a href="../misc/Labels.htm">标签</a></p> <h2 id="Examples">示例</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> 显示 5 次消息框, 为从 6 到 10 的每个数字显示一次. 注意 Loop 的前 5 次循, Continue 语句会使得循环在到达 MsgBox 行前重新开始.</p> <pre> Loop 10 { if (A_Index &lt;= 5) continue MsgBox A_Index }</pre> </div> <div class="ex" id="ExContinueOuter"> <p><a class="ex_number" href="#ExContinueOuter"></a> 从内嵌循环内部直接继续新的外层(outer) 循环.</p> <pre>outer: Loop 3 { x := A_Index Loop 3 { if (x*A_Index = 4) continue outer <em>; 等同于 <b>continue 2</b> 或 <b>goto continue_outer</b>.</em> MsgBox x "," A_Index } continue_outer: <em>; 用于 goto 命令.</em> }</pre> </div> </body> </html>