Variables is for temporary storage of data. the keywords is DIM.
Variables
A Variable is memory allocation for data storage. It has got an address, name, value and type
Address: Physical space in the computer memory where data is stored.
Name: Unique identifier for which it can be referred as. Naming convention:
A) a-z, A-Z, 0-9
B) It can not start with a number
C) It can not be part of reserved keywords of the language
D) No special characters except underscore.
Value: Data stored in the variable.
Type: Classification of data stored according to its format.
- String = Variable type that stores characters
- Integer = Variable type that stores whole numbers lesser that 32000 aprox.
- Long = Variable type that stores whole numbers greater that 32000 aprox.
- Decimal = Variable type that stores number that require a decimal value
- DateTime = Variable type that stores date values
Boolean = Variable type that stores either true or false values
<%
'Declare variable and assign it a value
DIM a AS Decimal = 50.14
'show on the screen
Response.Write(a)
Response.Write("<BR>")
%>
<%
'Declare variable and assign it a value
DIM b AS Integer = 1562154
'show on the screen
Response.Write(b)
Response.Write("<BR>")
%>
<%
'Declare variable and assign it a value
DIM c AS String = "this is string"
'show on the screen
Response.Write(c)
Response.Write("<BR>")
%>
<%
Dim TheDate As DateTime
TheDate = "18/05/2006"
Response.Write(TheDate)
Response.Write("<br>")
%>