type while/wend loop

BlitzMax Forums/BlitzMax Beginners Area/type while/wend loop

I think its been asked before, seem to remember seeing it, but can't find it, so I am just going to ask:

With B+ and B3D, you can go through a type list in reverse by doing something like this:

type testtype
end type

test.testtype = last testtype
while test <> null

test = before test
wend


How would you go about doing the same with Bmax ?

This seems to work...
Strict

Type test
	Field id:Int
End Type
 
Local List:TList = New TList

For Local c:Int=1 To 50
	Local t:test = New test
	t.id = c
	List.AddLast(t)
Next  

Local Link:TLink = List.LastLink()
While Link
	Print test(Link.Value()).id
	
	Link = Link.PrevLink()
Wend

End


For some reason I can't get the above to work, is there a way to do the following in reverse order?

Global GUI_WINDOW_LIST:TList = CreateList()
Type GUI_WINDOW
End Type

For Local wgui:GUI_WINDOW = EachIn GUI_WINDOW_LIST
Next


Global GUIWinList:TList = CreateList()
Type TGUIWin
	Field val:Int
End Type

For Local t:Int =0 To 10
	Local tempwin:TGUIWin = New TGUIWin
		tempwin.val = t
		GUIWinList.AddLast(tempWin)
	tempwin = Null
	FlushMem
Next

Local Link:TLink = GUIWinList.LastLink()
While Link
	Print TGUIWin(Link.Value()).val
	
	Link = Link.PrevLink()
Wend


You can't use Eachin without implementing your own enumerator.

I didn't get how the value() thing worked, but looking at your code examples I got it working now and figured out what it does. so thanks guys, the help is appreaciated.