| << 4.1.0- What is a Variable? | Chapter4 | 4.1.2- Data Types in VBScript, or One Type For All >> |
Creating a Variable
In the above code example, two things are happening. Firstly, three variables are created and secondly they are given values to store. We'll discuss more about the latter a bit further on in this chapter, but for now, let's concentrate on the first three lines of this example:
Dim CapitalCityOfUK
Dim NumberOfStates
Dim IndependenceDay
We are instructing VBScript to create three empty variables called CapitalCityOfUK, NumberOfStates and IndependenceDay. You can create any variable in a similar manner, using the Dim keyword followed by the name of the variable. There is, however, a quicker way to declare many variables at once, for example:
Dim CapitalCityUK, NumberOfStates, IndependenceDay
This does exactly the same thing as the three lines above – it creates three separate variables as before, which are empty and ready to accept data.
We'll discuss creating (or declaring) variables again later .
| << 4.1.0- What is a Variable? | Chapter4 | 4.1.2- Data Types in VBScript, or One Type For All >> |

RSS
