02-18-2023, 10:01 PM
another snippet for studying how QB64 manages the declaration of an array
Code: (Select All)
Option _Explicit
_Title "Array with variable as index"
Type Test
X As Integer
y As Integer
z As String
End Type
Dim As Integer abc(1 To 4), m
m = 15 ' REMming this line of code and running this code you get
' runtime error for subscript out of range
Dim As Test xyz(1 To 10, m)
m = 1
xyz(1, m).X = 5
m = 2
xyz(1, m).y = 3
m = 12
xyz(1, m).X = m
Rem m = 16
Rem xyz(1, m).X = m
m = 1
Print xyz(1, m).X
m = 2
Print xyz(1, m).y
m = 12
Print xyz(1, m).X
Rem m = 16
Rem Print xyz(1, m).X