ASP/VBScript While … Wend Executes a series of statements as long as a given condition is True.
ShotDev Focus:
- Using Asp and While … Wend
Syntax
While condition Version [statements] Wend
The While…Wend statement syntax has these parts:
Part | Description |
condition | Numeric or string expression that evaluates to True or False. If condition is Null, condition is treated as False. |
statements | One or more statements executed while condition is True. |
Remarks
If condition is True, all statements in statements are executed until the Wend statement is encountered. Control then returns to the While statement and condition is again checked. If condition is still True, the process is repeated. If it is not True, execution resumes with the statement following the Wend statement.
While…Wend loops can be nested to any level. Each Wend matches the most recent While.
|
|
Tip The Do…Loop statement provides a more structured and flexible way to perform looping. | |
|
Example
asp_while_wend.asp
<% Option Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Dim i i = 1 While i <= 5 Response.write("www.ShotDev.Com<br>") i = i + 1 Wend %> </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_while_wend.asp
Screenshot