PDA

View Full Version : Enumeration



Charles Pegge
18-03-2009, 10:04
From the Lewis Carroll school of computer science:






'ENUMERATIONS
'

uses "oxygen","file"
dim src as string

src = "

dim a as long

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

enum things
shoes ships sealing_wax cabbages kings
end enum

print `value ` things.cabbages


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

enum things
shoes 11 ships sealing_wax cabbages kings
end enum

print `value ` things.cabbages


'-------------------
'BITWISE ENUMERATION
'===================

enum bit things
shoes ships sealing_wax cabbages kings
end enum


a=things.shoes or things.cabbages
print `value ` a

"

o2_basic src

'msgbox 0, o2_view "o2h "+src

if len(o2_error) then
msgbox 0, o2_error : stop
end if

o2_exec