VBScript:While…Wend循环

While..Wend循环中,如果条件为True,则将执行所有语句,直到遇到Wend关键字为止。

如果条件为false,则退出循环,并且控件跳至Wend关键字之后的下一个语句。

语法

VBScript中While..Wend循环的语法是:

While condition(s)
   [statements 1]
   [statements 2]
   ...
   [statements n]
Wend

流程图

VBScript:While...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

作者:terry,如若转载,请注明出处:https://www.web176.com/vbscript/1261.html

(0)
打赏 支付宝 支付宝 微信 微信
terryterry
上一篇 2020年12月9日 下午5:34
下一篇 2020年12月9日 下午5:40

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注