
- VBScript 教程
- VBScript - 主頁
- VBScript - 概述
- VBScript - 語法
- VBScript - 啟用
- VBScript - 定位
- VBScript - 變數
- VBScript - 常量
- VBScript - 運算子
- VBScript - 決策
- VBScript - 迴圈
- VBScript - 事件
- VBScript - Cookies
- VBScript - 數字
- VBScript - 字串
- VBScript - 陣列
- VBScript - 日期
- VBScript 高階
- VBScript - 過程
- VBScript - 對話方塊
- VBScript - 面向物件
- VBScript - 正則表示式
- VBScript - 錯誤處理
- VBScript - 雜項語句
- VBScript 有用資源
- VBScript - 問題和答案
- VBScript - 快速指南
- VBScript - 有用資源
- VBScript - 討論
VBScript While…Wend 迴圈
在While..Wend 迴圈中,如果條件為真,則執行所有語句,直到遇到Wend 關鍵字。
如果條件為假,則退出迴圈,並且控制跳轉到Wend 關鍵字之後的下一條語句。
語法
VBScript 中While..Wend 迴圈的語法為 -
While condition(s) [statements 1] [statements 2] ... [statements n] Wend
流程圖

示例
<!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> Dim Counter : Counter = 10 While Counter < 15 ' Test value of Counter. Counter = Counter + 1 ' Increment Counter. document.write("The Current Value of the Counter is : " & Counter) document.write("<br></br>") Wend ' While loop exits if Counter Value becomes 15. </script> </body> </html>
執行以上程式碼時,將在控制檯列印以下輸出。
The Current Value of the Counter is : 11 The Current Value of the Counter is : 12 The Current Value of the Counter is : 13 The Current Value of the Counter is : 14 The Current Value of the Counter is : 15
vbscript_loops.htm
廣告