VBScript while..Wend Loop
VBScript while..Wend Loop
- In VBScript, While..Wend is used for representing a while loop.
- If condition is true then all the statements until the Wend keyword will be executed.
- Wend represents end of while block in VBScript
- If condition become false then statement next to Wend Keyword will be executed.
While..Wend Syntax
Below statements are used to represent the While..Wend loop
While condition(s) [statements 1] [statements 2] [statements 3] ... [statements n] Wend
Flow Diagram
While..Wend Example
<!DOCTYPE html>
<html>
<body>
<script language="vbscript" type="text/vbscript">
Dim i : i = 0
While i < 5
i = i + 1
document.write("Value of the i is : " & i)
document.write("<br>")
Wend
</script>
</body>
</html>
When the above code is executed, it prints the following output in the console.
Value of the i is : 1 Value of the i is : 2 Value of the i is : 3 Value of the i is : 4 Value of the i is : 5

