VBScript is a subset of Visual Basic 4.0 language which is developed by Microsoft. VBScript provides more processing power to Web pages. Writing of both server side and client side scripting can be done by VBScript.
It supports only one data type which is known as Variant and this variant comes under a special category of data types which consists of many types of data. Well Variant is the default type returned by all functions in VBScript.
And Variables the location which stores the information of program which may change at the run time.
Some of the sub data types in Variant are
10. Date (Time)
Conversion functions are used to covert data from one sub data type to another type.
Creating a variable:
Variables are used to store information. Observe how a variable is created and a value assigned to it.
<script type= “text/vbscript”>
name= “Garuda Trainings”
How Variable declaration is done in VBScript?
Eg: Dim x
X = 100 Normal declaration
Eg: Optional Explicit
X = 100 When optional explicit is included
Optional Explicit statement should be in the first statement in the script. This Option Explicit is used when you declare a variable implicitly by using the name in a simple manner in your script and this may result in unexpected results.
Three important points to remember in VBScripts:
Optional Explicit statement should be the first statement in the script.
Public statement variable are available to all procedures in all scripts.
Private statement variables only to the script in which they are declared.
Converting a variable into array:
Eg : Dim x
X = array(“what”,“is”,“that”)
for i=lbound(x) to ubound(x)
Here ‘x’ is a dynamic array.
Constant is a word which means fixed. It occupies the place of a number, symbol, or a string and never changes. Some of the intrinsic constants in VBScript are vbOK, vbCancel, vbTrue, vbFalse etc .
const str = “Performance”
In the above statement str is a constant and hence its value does not change. Constants are of two types which are Public and Private but by default all constants are Public.