用户登录
用户注册

分享至

VBS教程:语句-While...Wend 语句

  • 作者: 你萌不懂胖子的忧桑
  • 来源: 51数据库
  • 2021-07-09

while...wend 语句

当指定的条件为 true 时,执行一系列的语句。

while condition
 
;  version [statements]
wend

参数

condition

数值或字符串表达式,其计算结果为 true 或 false。如果 condition 为 null,则 condition 被当作 false。

statements

在条件为 true 时执行的一条或多条语句。

说明

如果 condition 为 true,则 statements 中所有 wend 语句之前的语句都将被执行,然后控制权将返回到 while 语句,并且重新检查 condition。如果 condition 仍为 true,则重复执行上面的过程。如果不为 true,则从 wend 语句之后的语句继续执行程序。

while...wend 循环可以是多层嵌套结构。每个 wend 与最近的 while 语句对应。

注意 do...loop 语句提供一种结构化与适应性更强的方法以执行循环。

下面例子举例说明如何使用 while...wend 语句:

dim countercounter = 0                '初始化变量。while counter < 20         ' 测试计数器的值。   counter = counter + 1   ' 增加计数器。   alert counterwend                       ' 计数器大于 19 时终止循环。

要求

版本 1

软件
前端设计
程序设计
Java相关