Iterators / generators
BlitzMax Forums/BlitzMax Programming/Iterators / generators
| ||
Just noticed something while looking at the TMap source:Type numbers Field n1,n2 Method New() n1=0 n2=1 End Method Method HasNext() Return 1 End Method Method NextObject:Object() n3=n2 n2=n1+n2 n1=n3 Return String(n2) End Method Method ObjectEnumerator:numbers() Return Self End Method End Type ne:numbers=New numbers For a$=EachIn ne Print a If Int(a)>100000 End Next |
| ||
I knew you could do that sort of thing in brisk, but not in blitzmax. |
| ||
this is somewhat discussed in the docs, under Help/Language/Collections. The docs were a little vague, you can look at the TList module for an implementation. |