Does BlitzMax have ENUMs?

BlitzMax Forums/BlitzMax Beginners Area/Does BlitzMax have ENUMs?

Count me in as wanting them - there very handy indeed!

You need to point out the actual use of enums (as outlined, it's great with intellisense), but it does allow you to structure your code nicely (as any VB or VB.Net user would know):

Enum Primitive
   Triangle = 1
   Quad = 2
   Polygon = 3
   TriangleStrip = 4
   TriangleFan = 5
End Enum


It could then be used as follows:

Function GetPrimative:String(PrimType:Primitive)
   
   Select PrimType
      Case Primitive.Triangle
          Return "Triangle"

       Case Primitive.Quad
          Return "Quad"

      Case Primitive.Polygon
          Return "Polygon"

      Case Primitive.TriangleStrip
          Return "TriangleStrip"
    
      Case Primitive.TriangleFan
          Return "TriangleFan"
      
      Case Default
          Return "Unknown"

   End Select

End Function


Print GetPrimitive(Primitive.Triangle)


@teamonkey
Your point about adding other constants is easily done without affecting the current list (or references like Select Case statements as above) - the actual integer value is irrelevant as you refer to the name, not it's value - if you get my drift.

Once you get the hang of it, it makes your code so much more readable.

@bradford
Enums are certainly much more flexible (and powerful) than consts if used correctly. The list you have created could apply to anything - enums can be much more specific.