Vbscript-while-wend-loop
提供:Dev Guides
VBScript While … Wendループ
*While..Wend* ループでは、条件がTrueの場合、 *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