03-26-2024, 06:47 PM
Yes, I modified ReDim to try it out.
An array created with ReDim is automatically declared as a dynamic array. So far so good. Now when I comment out Data I get an error saying "Read..." and I don't know why. Why is it “Out of Data” now?
The part with the for loop is clear, but the top part is not clear to me.
I'm afraid I'll have to create a corresponding program to understand what's going on.
An array created with ReDim is automatically declared as a dynamic array. So far so good. Now when I comment out Data I get an error saying "Read..." and I don't know why. Why is it “Out of Data” now?
The part with the for loop is clear, but the top part is not clear to me.
I'm afraid I'll have to create a corresponding program to understand what's going on.
Code: (Select All)
Screen _NewImage(800, 600, 32)
ReDim num(1000) As Integer
Do
Read num(count)
Print num
If num(count) <> -1 Then count = count + 1 Else Exit Do
Loop
ReDim _Preserve num(count) As Integer
Print "There were "; count;
Print "numbers counted and stored in our array (with end of data marker of -1)"
Print "They were:"
Print "(Index)", "(Value)"
For i = 0 To UBound(num)
Print i, num(i)
Next
End
'Data 1,2,3,4,5,6,7,8,9,-1