Enumerations


Syntax
Enumeration [<constant> [Step <constant>]] 
  #Constant1
  #Constant2 [= <constant>]
  #Constant3
  ...
EndEnumeration
Description
Enumerations are very handy to declare a sequence of constants quickly without using fixed numbers. The first constant found in the enumeration will get the number 0 and the next one will be 1 etc.. It's possible to change the first constant number and adjust the step for each new constant found in the enumeration. If needed, the current constant number can be altered by affecting with '=' the new number to the specified constant. The reserved constant #PB_Compiler_EnumerationValue store the next value which will be used in the enumeration. Can be useful to chain several enumerations.

Example: Simple enumeration

  Enumeration
    #GadgetInfo ; Will be 0
    #GadgetText ; Will be 1
    #GadgetOK   ; Will be 2
  EndEnumeration

Example: Enumeration with step

  Enumeration 20 Step 3
    #GadgetInfo ; Will be 20
    #GadgetText ; Will be 23
    #GadgetOK   ; Will be 26
  EndEnumeration

Example: Enumeration with dynamic change

  Enumeration
    #GadgetInfo      ; Will be 0
    #GadgetText = 15 ; Will be 15
    #GadgetOK        ; Will be 16
  EndEnumeration

Example: Chained enumerations

  Enumeration
    #GadgetInfo ; Will be 0
    #GadgetText ; Will be 1
    #GadgetOK   ; Will be 2
  EndEnumeration
  
  Enumeration #PB_Compiler_EnumerationValue
    #GadgetCancel ; Will be 3
    #GadgetImage  ; Will be 4
    #GadgetSound  ; Will be 5
  EndEnumeration