Enum (gb)

This static class is used for implementing enumerable classes.

You must use this class inside the implementation of _next special method.

Note: ENUM is also a keyword used for Enumeration declaration

This class is static.

This class is statically enumerable with the FOR EACH keyword.

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

Static methods
Stop   Stops the current enumeration.

See also

Example

From Gambas source code:

'' Return recursively all the options available (line 307)
Public Function _next() As String
  
  Dim s As String
  
  If Not $aOptionsNames Then GetOptions
  If IsNull(Enum.Index) Then 
    Enum.Index = 0
  Else
    Inc Enum.Index
  Endif
  If Enum.Index >= $aOptions.Count Then 
    Enum.Stop
    Return
  Endif
  
  s = $aOptionsNames[Enum.Index]
  Return s
  
End