Oxygen

enum
ACTION: create an enumeration
USE: assign a numeric identity to a name
 

  '------------
  'ENUMERATIONS
  '============

  'SIMPLE ENUMERATION
  '==================

  enum ManyThings
    shoes 
    ships
    sealing_wax
    cabbages
    kings
  end enum

  def show "%1: " %1

  print show cabbages 


  'ENUMERATION FROM A BASE VALUE
  '=============================

  enum ManyThings
    shoes=11
    ships
    sealing_wax
    cabbages
    kings
  end enum

  print show ships 


  'BITWISE ENUMERATION
  '===================
  '1 2 4 8 16 32 64 ...

  enum bit ManyThings
    shoes
    ships
    sealing_wax
    cabbages
    kings
  end enum


  'ENUMERATION USAGE
  '=================

  'Dim as ManyThings mt
  ManyThings mt
  mt=cabbages
  print mt
  




  
REMARKS: C syntax is supported for this construct. Also enum bit
assigns values 1,2,4,8,16.. instead of 0,1,2,3,4..

RELATED: typedef enum #define (%)