VBScript Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 4.01

Array Declaration and Built-in Functions

Part:   1  2  3  4  5  

VB Script Tutorials - Herong's Tutorial Notes © Dr. Herong Yang

Data Types and Literals

Variables

Logic Operations

String Operations

Conditional Statements

Arrays

Loop Statements

Functions and Subroutines

Built-in Functions

Variable Inspection

... Table of Contents

(Continued from previous part...)

Here is the output:

Favorite pets:
   Dog
   Cat

Favorite fruits:
   Apple
   Orange

Erasing arrays...

Pets left:
   
   
   Count = 2

Fruits left:
   Count = 0

I don't see any surprises in the output. Do you?

Conclusions

  • There two types of arrays: fixed-size array and dynamic-size array.
  • "Dim" and "ReDim" specify upper bound of array index, not the size.
  • "Array" is a useful function to create a dynamic-size array quickly.
  • "For Each" can iterate through an array with a temporary variable to hold a copy of the current element value.

Part:   1  2  3  4  5  

Dr. Herong Yang, updated in 2006
VBScript Tutorials - Herong's Tutorial Notes - Array Declaration and Built-in Functions