How does one declare an array in VBScript? How does one declare an array in VBScript? arrays arrays

How does one declare an array in VBScript?


You can also create arrays dynamically using the Array function. Sometimes this is more convenient than assigning array elements separately.

Dim arrarr = Array("sample 1", "sample2", "sample 3")


VBScript's (variables and) arrays can't be typed, so no "as Whatever". VBscript's arrays are zero-based, so no "(x To y)" but only "(z)" where z is the last index (not the size) of the array. In code:

>> Dim varScreen(2)>> varScreen(0) = "sample 1">> varScreen(1) = "sample 2">> varScreen(2) = "sample 3">> WScript.Echo Join(varScreen, "|")>>sample 1|sample 2|sample 3>>