Home  |  Latest News  |  Contribute  |  F.A.Q.  |  Account  |  Scripts | About
Search ASPNut:
 
ASP Reference
Server Variables
ASP Glossary
Related Sites

Free Components

Web Colors
Entities
CSS Level 1
Encode/Decode
Glossary

Our Sponsors
ASP Nuke CMS
Free Auctions
PHP 5 Script
Funktastic Blog
ULost Directory
Team Task

 

 

 

 

 

 

 

 

 

 

 

 

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.

Orvado, San Diego Web Design

ASP Nuke CMS
Free Open Source
Content Manager
GoSwap Auctions
Buy, Sell
No Fees!

Contact Us | Contribute | About | Site Map



"Watching football is like watching pornography. There's plenty of action, and I can't take my eyes off it, but when it's over, I wonder why the hell I spent an afternoon doing it." - Luke Salisbury

©2012 San Diego Web Design - Orvado Technologies, All Rights Reserved
ASP Nut provides articles and reference documentation for Active Server Page developers.