- 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
广告