1.

How To Declare An Array In Vbscript?

Answer»

arrays are declared the same WAY a variable has been declared except that the DECLARATION of an array variable USES parenthesis. In the below example, the size of the array is mentioned in the brackets.

Example:

'Method 1 : USING Dim
Dim arr1() 'Without Size
'Method 2 : Mentioning the Size
Dim arr2(5) 'Declared with size of 5
'Method 3 : using 'Array' Parameter
Dim arr3
arr3 = Array("apple","Orange","Grapes")

arrays are declared the same way a variable has been declared except that the declaration of an array variable uses parenthesis. In the below example, the size of the array is mentioned in the brackets.

Example:

'Method 1 : Using Dim
Dim arr1() 'Without Size
'Method 2 : Mentioning the Size
Dim arr2(5) 'Declared with size of 5
'Method 3 : using 'Array' Parameter
Dim arr3
arr3 = Array("apple","Orange","Grapes")



Discussion

No Comment Found