ASP Tutorial part 2

Last time round we stopped with just on printing output with asp.It means that you can print html tags and html content using ASP the same way PHP or JSP does.

Now we will see some commonly used variable declarations and loop constructs in ASP.


People who have worked in Visual Basic will have come accross the Dim keyword. Its the same way variables are declared in ASP.

[code lang=”asp”]


As you can see, the Ampersand operator is used for appending.


You can declare and use arrays in the following manner. We will see how to use loops so that you can access the array elements

[code lang=”asp”]

For Next Loop

This is the general for loop you might have used in some application.

[code lang=”asp”]
Dim variable
for variable=start to end [optional step argument]

The step argument is used to increment the variable in steps less than or more than 1

Do Loops

[code lang=”asp”]


IF statements

[code lang=”asp”]

Select Case

[code lang=”asp”]

Select Case variable
case 1
response.write(“case 1”)
case 2
response.write(“case 2”)
case 3
response.write(“case 3”)

end select


We will see about Functions and Procedures in the next part.

Exit mobile version