The VBScript is a derivative of Visual Basic, and variable behave much the same way. To declare them using the Dim statement example :
Code:
Dim variable1
Dim variable2
etc..
Or
Code:
Dim variable1, variable2, etc..
Those accustomed to other languages knows that declaring a variable must also define the type, that is if will contain a number, string, date, etc.. In VBScript, this distinction does not exist: it is not necessary to declare the type of variables. The management of a number or a string is assigned VBScript interpreter. This makes it much easier to program, but be careful, as in the following example:
Code:
<script language="VBScript">
<! -
dim a, b, c
a = inputbox ("First Number:")
b = inputbox ("Second Number")
c = a + b
document.write c
//-->
</ Script>
In the above example, assign values to variables a and b through the InputBox, that dialog boxes that prompt the user to enter a value. If I assign the value 3 and 5, the first second, it is expected that the line "document.write c" print the value of 8 and 35 show instead.
Bookmarks