While Loop
The While statement allows you to create a loop that repeats a block of code
while a certain condition is met. The expression following the
While keyword determines when the loop is terminated. As long
as the condition is true, the loop will continue to execute.
All of the code that is enclosed within a While .. Wend
block will be executed as long as the condition is true.
Dim nRand ' random number 1 - 10
' prints out series of random numbers until "10" is hit
Randomize nRand = Int(Rnd() * 10) + 1 While nRand <> 10 Response.Write "Random: " & nRand & "<BR>" nRand = Int(Rnd() * 10) + 1 Wend
You may also use a Do While .. Loop block to build a
loop idential to the While loop. The advantage of using a
Do loop is that you may use the Exit Do statement to
terminate the loop at any point within the block of code.
|
 |

|