LOTUSSCRIPT LANGUAGE
' The array x has not been previously declared, ' so ReDim automatically assigns it the data type Variant. ReDim x(5) Print DataType(x(1)) ' Prints 0.
' The Dim statement declares array y with the ' data type String. Dim y() As String
' The ReDim statement canft change the data type of an ' existing array. If you specify a data type for array y in ' the ReDim statement, it must be String.
ReDim y(5) As String Print DataType(y$(1)) ' Prints 8.
Example 2
Option Base 1 ' Declare a two-dimensional dynamic array, of Variant type. ReDim markMar(2, 2)
' Assign a value to each element. markMar(1, 1) = 1 markMar(2, 1) = 2 markMar(1, 2) = 3 markMar(2, 2) = 4
' Change the upper bound of the last dimension of markMar ' from 2 to 3, preserving the values already stored in ' existing elements of markMar. ReDim Preserve markMar(2,3)
' Assign values to the additional elements of markMar. markMar(1, 3) = 5 markMar(2, 3) = 6
See Also