Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 03-08-2004, 06:11 PM   #1 (permalink)
rdove
Masked Moderator
 
rdove's Avatar
 
Join Date: May 2002
Location: Indianapolis, IN
Posts: 260
rdove is on a distinguished road
Basic Looping

This tutorial is going to cover simple looping with ASP. If you have ever used Visual Basic then a lot of this will look very fimilar because it is essentially the same.

First I will talk about a for...next loop. For...Next loops are good when you want to increment by numbers. For example:

Code:
Dim i

For i = 0 to 10
  response.write(i)
Next
This will write out all the numbers from 0 to 10, then the loop will break.

Next is the While loop. A while loop will process until the condition returns false.

Code:
Dim i

i = 0

While i < 10
  response.write(i)
  i = i + 1
Wend
In this instance numbers 0 to 9 will be outputted on the page. Since i needs to be less than 10 after 9 is reached the loop will break because it has returned false.

Next we have the Do loops. There are 2 types of Do loops: Do...While & Do...Until. Do...While Loops are similar to While loops, they will process until the condition is false.

Code:
Do While i < 10
  response.write(i)
  i = i + 1
Loop
On the Otherhand, a Do...Until loop will process until the condition is met or true.

Code:
Do Until i = 10
  response.write(i)
  i = i + 1
Loop
That is a short basic tutorial on the types of loops that can be used in ASP.

Tutorial written by:
Ryan Wischmeyer 2004, Indianapolis, IN
__________________
~Ryan

rdove is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
So Basic, So Stupid. BulletproofPeep Standard C, C++ 2 03-24-2004 05:34 PM
Can anyone recommend a very basic message board? Epsilon PHP 2 02-29-2004 08:02 AM
basic html table question prendo HTML, XML, Javascript, AJAX 2 03-03-2003 04:08 PM
Basic, not visual platjyjim All Other Coding Languages 1 03-01-2003 09:00 AM


All times are GMT -8. The time now is 09:15 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting