Book Store  
  Contact Us  
  Links  
  Site Map  
ASP Scripts - do while loops

Loops

 

Do While....Loop

The do while loop and the do until loop are used to loop around until a condition is met.

<%
thenumber=0

Do While thenumber < 10
response.write(thenumber & "<br/>")
thenumber = thenumber + 1
Loop
%>

In the above example the do while loop will run while thenumber is less the 10. When thenumber = 10 it will exit the loop.

Do Until....Loop

In the following example, the loop will continue until the condition is met.

<%
thenumber=0
Do Until thenumber = 10
response.write(thenumber & "<br/>")
thenumber = thenumber + 1
Loop
%>