comp • gb • enum

Enum (gb)

This static class is used for implementing enumerable classes.

You must use it inside the implementation of _next special method.

This class is static.
This class is
Returns all current enumerations of the current object.
statically enumerable
with the FOR EACH keyword.

Static properties

Static methods
Returns or sets a value that is used for referencing the next enumerated element.
Index  
Return if the current enumeration has been stopped.
Stopped  
Stops the current enumeration.
Stop  

See also

Example

From Gambas source code:

''List all the existing devices
Public Function _next() As String
  
  Dim s As String

  If Not $aScannerNames Then Search(True)
  If IsNull(Enum.Index) Then 
    Enum.Index = 0
  Else
    Inc Enum.Index
  Endif
  If $aScannerNames.Count = 0 Or If Enum.Index >= $aScannerNames.Count Then 
    Enum.Stop
    Return
  Endif
  
  s = $aScannerNames[Enum.Index]
  Return s
  
End