Do you HAVE to loop through types?

Blitz3D Forums/Blitz3D Beginners Area/Do you HAVE to loop through types?

Why not use an array of types like so ...


Type Test
 field x, y
end type

Dim MyType.Test( 100 )

For l = 0 to 100
  MyType(l)  = new Test
  MyType(l)\x = rand(10)
  MyType(l)\y = rand(10)
next



Then you can iterate through a specific number of them ...

for l = 12 to 22
  x = MyType( l )\x
next


Alternatively, depending on how you're doing things you could make use of the object & handle commands.

Stevie