Friday, September 9, 2011

VBScript Array

VBScript Array
VBScript Array function returns a Variant containing an array.

Syntax of VBScript Array
Array(argumentlist)

argumentlist is a comma-delimited list of values that are assigned to the elements of an array contained with the Variant. If no arguments are specified, an array of zero length is created.

Example 1 of VBScript Array
myarray = array("One", "Two", "Three", "Four")
for i=0 to UBOUND(myarray)
msgbox (myarray(i)) 'Show array contents i.e. first time One, Second time Two and so on...
Next

Example 2 of VBScript Array
Arr=Array(5,10,15,20)
for each x in Arr
msgbox x 'Show array contents i.e. first time 5, Second time 10 and so on...
next


Also See:
Complete List of VBScript Array Functions