Tuesday, August 31, 2010

Different ways of Declaring Variables in ASP

Variables are used to store information. When we declared a variable a space in the hip memory is allocated for that variable. This article demonstrates how to declare a variable in classic ASP using VB script, and how to assign a value to it, and use the value in a text.

Declaring variables in ASP is simple, especially since all variables are of type Variant. You don't have to define the variable's type (such as if it's an integer, string, etc.). Rather, you just declare the variable using the Dim keyword and it has the potential to be anything

Variables can be declared one at a time or all at once. Below is an example of both methods.

          'Single Variable Declarations
               Dim myVar1 
               Dim myVar2 
       'Multiple Variable Declarations
              Dim myVar6, myVar7, myVar8

The below example demonstrate how to initialize a variable at the time of declaration

         Dim MyVariable : MyVariable = 50 


No comments:

Post a Comment