Customer Login  .   Webmail Login  .   About Us  .   Contact Us
Go to: Articles List

Looping Logic Part 3 : While...WEnd Statements
[Part 1 | Part 2 | Part 3 | Part 4]

     The While...WEnd loop is very similar to the Do loop. This loop performs the requested action until a condition is met. The only difference is a small amount of syntax.

     The snytax for the While loop follows:

While {Condition}
'Perform this...
WEnd

NOTE: Leave off the { } brackets in the real code.

The While loop is commonly used to loop through a recordset that has been returned from a database. The following code demonstrates this:

While NOT RS.EOF
     Response.Write("Name = " & RS("lname") & ", " & RS("lname") & "<br>")
     RS.MoveNext
WEnd

In the above code we construct the While statement to loop through the RS object, pulling out the "lname" and "fname" elements from each record. When the condition of the RS reaching the end of the file (RS.EOF, after the last record), the statement exits.

Shared Hosting
Rookie
Pro
Advanced
Dedicated Servers
BASE
BUSINESS
ENTERPRISE
Why Choose Brinkster?
Radical Support
Brinkster Datacenter
Brinkster Network
Corporate Social Responsibility
90 Day Money Back Guarantee
Unsurpassed Value
Client Testimonials
Additional Features
Antivirus
Merchant Account
E-Commerce
Live Chat Communicator
Free Firewall
Website Builder
Free Web Hosting
Support
General Support
Codebank Search
Forums
Articles
Click here for Brinkster Live Chat
Home   Domains   Shared Hosting   Dedicated Hosting   Partner   Support   About Us    Contact Us   Webmail
Copyright © Brinkster Communications Corporation All Rights Reserved. Privacy Policy & Legal