在While..Wend循环中,如果条件为True,则将执行所有语句,直到遇到Wend关键字为止。
如果条件为false,则退出循环,并且控件跳至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
作者:terry,如若转载,请注明出处:https://www.web176.com/vbscript/1261.html