<
Previous lesson
|
Table of Content
|
Content
of this Chapter
|
Next lesson
>
Dynamic Array
Type the following code
Dim DynArray() As Integer
Dim i As Integer
Dim k As Integer
For i = 4 To 10k = k + 1Next i
ReDim Preserve DynArray(k)
DynArray(k) = i
Me.Print UBound(DynArray)
1. Debug the value of
DynArray
2. Remove the keyword
Preserve
and debug the value
of
DynArray
.
3. What is your conclusion on the usage of keyword
Preserve
?
4. Check why the following code does not work and fixed it.
Dim DynArray() as Integer
Dim i as Integer
Dim k as Integer
For i = 1 to 10k = UBound(DynArray) + 1Next i
ReDim Preserve DynArray(k)
DynArray(k)=i
<
Previous lesson
|
Table of Content
|
Content
of this Chapter
|
Next lesson
>