| When users interact with computers, they usually get to some point where the |
| computer asks them for information. That information is stored or manipulated by |
| the computer in some way. Suppose, for example, that you want to keep a record |
| of the number of times the user has clicked the button. In that case, you would |
| want to store a value in memory. In any ca se, you need a "container" in which to |
| What is a variable? |
| A variable is a virtual container in the computer's memory or convenient |
| placeholder that refers to a computer memory location where you can store |
| program information that may change during the time your script is running. |
| Where the variable is stored in computer memory is unimportant. What is |
| important is that you only have to refer to a variable by name to see or change its |
| value. In VBScript, variables are always of one fundamental data type, Variant. |
| A computer program can store information in a variable and then access that |
| Variables Naming Restrictions |
| Variable names follow the standard rules for naming anything in VBScript. A |
| variable name: |
| Must begin with an alphabetic charact er. |
| Cannot contain an embedded period. |
| Must not exceed 255 characters. |
| Must be unique in the scope in which it is declared. |
| Make sure you never create variables that have the same name as keywords |
| already used by VBScript. These keywords are called reserved words and |
| include terms such as Date, Minute, Second, Time, and so on. |
| How Do I Create a Variable? |
| When you create a variable, you have to give it a name. That way, when you need |
| to find out what's contained in the variable, you use its name to let the computer |
| know which variable you are referring to. You have two ways to create a variable. |
| The first way, called the explicit method, is where you use the Dim keyword to tell |
| VBScript you are about to create a variable. You then follow this keyword with the |
| name of the variable. If, for example, you want to creat e a variable called |
| Quantity, you would enter |
| |
No comments:
Post a Comment