Visual Basic 2008 Programming: Business Applications with a Design Perspective
Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9
Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Appendix A Appendix B Appendix C Home
Last change: February 13 2016 18:48:19.

 Chapter in PDF

Table of Contents

Chapter 4: Data, Operations, and Built-In Functions
Last change: February 13 2016 18:47:36.

4.1     Classification and Declaration of Data

Consider the following code:

MsgBox(“Your age is “ & 24)

As simple as this statement, two different types of data are involved. The text enclosed in a pair of quotation marks is a string, whereas the number, 24, is numeric. A string consists of zero or more characters; numeric data are numbers that can be used for various computations, and can be further classified into many different types.
All data must be stored somewhere in the computer memory before they can be retrieved for additional manipulation or display. If a memory location with some data is expected to change as a result of operations, it is recognized as a variable. A variable must be given a name so that you can refer to it. Data that present themselves “as is” and are never expected to change are recognized as constants. A constant can go without a name but can also be given a name. A constant without a name has to be presented and used as literal. A constant that is given a name and is referenced accordingly is recognized as a named constant.
To summarize, data can be classified by type into numeric and string, and by variability into constant and variable. The following table shows the cross-classifications:

Classification by: Variability/Data Type Numeric

(Name Required?)
Constant Numeric constant String constant Optional
Variable Numeric variable String variable Required
Last change: February 13 2016 18:47:38.
  1. 4.1 Classification and Declaration of Data
    1. Declaring Constants
    2. Declaring Variables
    3. Rules for Variable Declaration
    4. <<PreviousNext>>