Perl 繼續函式



說明

此函式是一個流程控制語句,而不是一個函式。如果有一個繼續塊附加到一個塊(通常在 while 或 foreach 中),它總是在條件重新評估之前執行,就像 C 中 for 迴圈的第三部分。

因此,即使透過 next 語句繼續迴圈,它也可以用來增加迴圈變數。last、next 或 redo 可能會出現在 continue 塊中。

語法

以下是此函式的簡單語法 −

continue BLOCK

返回值

此函式不返回任何內容。

示例

以下示例程式碼展示了它的基本用法 −

while (EXPR) {
   ### redo always comes here
   do_something;
} continue {
   ### next always comes here
   do_something_else;
   # then back the top to re-check EXPR
}
### last always comes here
perl_function_references.htm
廣告
© . All rights reserved.