while

當條件為真時,執行一組指令

while(<condition>)
  <commands>
endwhile()

介於 while 和相符的 endwhile() 之間的所有指令都會被記錄下來,但不會被執行。一旦 endwhile() 被執行,則只要 <condition> 為真,記錄的指令列表就會被執行。

<condition> 具有與 if() 指令所描述的語法相同,並使用相同的邏輯進行評估。

指令 break()continue() 提供了跳脫正常控制流程的方法。

依照慣例,endwhile() 指令允許一個可選的 <condition> 參數。如果使用,它必須是開頭 while 指令的參數的逐字重複。

參見