Chapter 3. Data Types
This chapter introduces VBScript data types, which, jumping ahead a little, is linked to the subject of the next chapter, "Variables and Procedures." The concepts of variables and data types are closely related. A variable is a name given to a location in memory where some data used by a program is stored. For example, a program that manages your music collection might have a variable called
Artist that might store the value
"James Brown". The variable named
Artist is a pointer to a location in the computer's memory where the value
"James Brown" is stored. (Lucky for us, for the most part VBScript keeps us from having to worry about things like pointers and memory.)
Variables can hold different types of data: numbers, dates, text, and other more specialized, or complex, categories. These categories into which values can be divided are called data types.
A full discussion of programming language design relative to the strengths and weaknesses of, and alternate techniques for, the use of data types is out of the scope of this book. Suffice to say that in VBScript programming, data types help simplify the logic of a programming language compiler and also help ensure proper and correct results during the program's execution. Even if you did not know a lot about how compilers work, you could imagine that the instructions given to your computer for adding numbers together, computing the length of time between two dates, and searching a long string of text for the occurrence ...