For Each on BlitzMax?

BlitzMax Forums/BlitzMax Beginners Area/For Each on BlitzMax?

Yue(Posted 2015) [#1]
Which is equivalent BlitzMax for a "for each" that was used in Blitz3D?

; For Each on B3d
for Obj.Car = Each Car 

   EntityColor Obj.Car\Mesh%, 255,0,0

Next





RustyKristi(Posted 2015) [#2]
Hey Yue,

You can always check out the examples included or blitzmax online manual here:

http://www.blitzbasic.com/bmdocs/command.php?name=EachIn&ref=goto

Local a[]=[0,5,12,13,20]

for b=eachin a
	print b
next 


or

For T:Obj = EachIn ObjList
...
Next 



hope that helps :-)


degac(Posted 2015) [#3]


The main difference between B3D and Bmax is that object and list are not directly related.
An object (Car) can be stored in different list (or map or array, or both!)
A list can store different type of object.
Its a more useful solution.


degac(Posted 2015) [#4]
Handling different type in the same list