Each type variable that is created has a handle which is assigned to the variable you specify - in your example, "a" is the handle, but because you re-use it each time round the loop, it will only ever point to the LAST one you created (ie number 100).
You can create an array and assign each array element to the type variable, like this:
So, you might ask, if I still have to use an array, why bother with types at all? Well, the first answer is that each type can hold more fields than just the "variable" you have defined.
Hope this helps!
You can create an array and assign each array element to the type variable, like this:
type Var field Variable end type dim my_type.var(100) for k=1 to 100 mytype(k)=new var mytype(k)\variable = rand(1,100) next ; Now you can refer to each individually- mytype(33)\variable=100
So, you might ask, if I still have to use an array, why bother with types at all? Well, the first answer is that each type can hold more fields than just the "variable" you have defined.
type Var field Variable field X_Coord field Y_Coord field name$ end type dim my_type.var(100) for k=1 to 100 mytype(k)=new var mytype(k)\variable = rand(1,100) mytype(k)\x_coord = rand(1,1000) mytype(k)\y_coord = rand(1,1000) next ; Now you can refer to each individually- mytype(33)\variable=100 mytype(33)\name$="Foo" mytype(62)\x_coord=123 mytype(62)\y_coord=101 mytype(62)\name$="Bar"
Hope this helps!