Amongst the others, ASP is my favourite programming language, and it was easiest for me to learn. Now I think its time to pass on my knowledge

.
ASP stands for
Active
Server
Pages. It is a programming language made by Microsoft.
Note: ASP is only available on Windows platforms. For documentations on how to install IIS Web Server, etc. please go to
www.microsoft.com, or if you have chosen a Web host, and they have got ASP successfully installed, then it's time to get coding! The default file will usually be default.extension.
Remember: ASP has an extension .asp
Firstly, ASP is basically VBScript, because VBScript is the default language for ASP, I recommend you just stick to VBScript when coding with ASP, for the benefit of understanding this tutorial.
Okay, make a document file named default.asp. And add the following lines:
Code:
<%
response.write("This is my web page!")
%>
The response.write is like the echo() function in PHP, it outputs strings, variables, etc. to a web page. Simply, you should have
This is my web page! on the page. Simple huh?
Next; Variables. Variables store information. For instance, variables themself, strings, numbers, etc. Here's an example:
Code:
<%
'This is a variable outputting a number, numbers DO NOT get quoted around.
dim x
x=1
'The response.write is outputting a variable, without quotation marks.
response.write(x)
'You can put a comma to declare many variables. Then we have chosen the variable y to have a value of 'Hello', then we asked the z variable to hold data of the y variable. Afterwhich, the z variable was outputted.
dim y, z
y="Hello!"
z=y
response.write(z)
%>
Remember: Variables can only start with A-Z or a-z and cannot contain periods.
Next; Select.
Code:
<%
dim x
x=1
Select Case x
Case 1
response.write("This is the correct case")
'This is incase all cases are false
Case Else
response.write("Case 1 is correct, so no need for me then :(")
End Select
%>
Next; Concatenation Operator
Code:
<%
dim x
x="Hello"
dim y
y="World!"
response.write(x & y)
%>
Next; IF statements. You can have logical operators: And, Or, Not. Also, you can have = equal to, <> not equal to, < less than and > more than. PHP has incrememt and decrement operators, ASP doesn't.
Code:
<%
dim x
x=1
dim y
y=1
If x = y Then
response.write("That is correct")
End If
%>
<%
dim zz
zz=2
dim aa
aa=5
If zz = yy Then
response.write("Huh? I thought the variables aren't the same?")
Else
response.write("I thought so. The variables are NOT the same!")
End If
%>
You can also add ElseIf, simply instead of putting Else add
If to the end, then afterwhich add Else then End If. To do And, Or logical operators, you simply do virtually the same thing:
Code:
If zz And yy = 2 Then
And so on...
However, to do the Not logical operator, you add Not just after the If, for example:
How about making sure a math sum is correct? :P
Code:
<%
If 5 + 5 = 10 Then
response.write("That's absolutely correct!")
Else
response.write("Umm..WRONG!")
End If
%>
You can also use many other operators such as - (subtraction), * (multiplication), / (division). You can also use other operators, but they are less needed, so I don't really think they are needed here in the tutorial.
Next; Arrays. Arrays are basically like the same variables used over and over again for different values.
Code:
<%
dim someArray(2)
'The first array is (0)
someArray(0) = "Hannah"
someArray(1) = "Fredrick"
someArray(2) = "Thomson"
response.write(someArray(0))
%>
<%
'Here is another neat trick:
dim somecoolarray()
'The Redim is to basically, once you have decided, to assign an integar to the array. The Redim can be used as many times as you want. The Preserve is to make sure the previous arrays before you Re declared the array to display for example when you use the response.write to output the arrays.
Redim somecoolarray(1)
somecoolarray(0) = "Robert"
somecoolarray(1) = "Ingrid"
Redim Preserve somecoolarray(2)
somecoolarray(2) = "Anna"
%>
That's it for now! I added this tutorial to basically help me remember ASP myself!

Hope you enjoy it!
I made this tutorial with extreme backache (lol), so no copying or re-distributing!