Arrays: An array is a variable that holds multiple values of the same type. Arrays are of two types: One is fixed and another is dynamic. Fixed arrays can be simply defined by using dim statement: Dim arr(10) this array can contain eleven values as array always start from 0 ' Example: Dim arr(10) For i=0 to 10 arr(i)= "Value" & i Next Another simple method can be as follows: Dim arr arr=Array(1,2,3,4,5,6,7,8,9,10) This will define the array of size of 9 automatically having values from 1 to 10. To Define dynamic arrays we will not specify the dimensions or length of the array when declaring the array we will use the redim statement for specifying the dimensions like Dim arr() ' this will initialize a array since we have not given dimensions in it we can not use it ReDim arr (10) 'this will initialize the array to a dimension of 10 i.e. 11 elements. Example: Di...
Comments
Post a Comment