iterating through types as a function?

Blitz3D Forums/Blitz3D Programming/iterating through types as a function?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

There is no "active one". What you need is to make your function return the found object, or null if not found.
Function findtruck.truck( id$ )
  For t.Truck = Each truck
    If truck\ID = id THen
      Return t
    End If
  Next
  Return Null
End Function


Then:
blah blah
t.truck = findtruck( "bigtruck" )
If t = Null Then
  ;handle case where not found
Else
  x# = truck\x#
  etc
EndIf