![]() ![]() To create a static array, you use a Dim statement with the array's common name, such as Dim arrGroc(2) You can create arrays several ways, depending on whether they are static or dynamic. You can increase or decrease the index size at any time. Dynamic arrays don't have a fixed index size. If you don't know this information or you know that the array's index size will change, you need to create a dynamic array. Thus, when you create a static array, you must know how many items the array will contain throughout its lifetime. ![]() ![]() Static arrays stay a fixed size throughout their lifetime-that is, the index size remains constant. You can create two types of arrays: static and dynamic. The 0 index represents the first position, the 1 index represents the second position, and the 2 index represents the third position in the array. ![]() For example, if an array has three items, the indexes are 0, 1, and 2. The indexes always increment sequentially, starting from 0. The index number is an integer subscript that denotes an item's relative location in the list. The common name typically includes the prefix arr to denote that the variable contains data of the subtype Array. The common name is the name of the array variable. You reference each item in this list with a common name and index number. Think of an array as a list (e.g., a list of usernames). An array lets you address many data values through the same variable. Unlike all the other subtypes I showed you last month, an array can hold more than one value. Related: Understanding VBScript: Operators I also cover multidimensional and nested arrays. This month, I take a close look at what Array variables, or simply arrays, are and how you can create, fill, resize, traverse, erase, split, and join them. However, I intentionally didn't discuss an important subtype: Array. Last month, I discussed three basic syntax elements: variables, constants, and subtypes. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |