Wiki

root/cobra/trunk/Tests/100-basics/307-enums.cobra

Revision 1702, 439 bytes (checked in by Chuck.Esterbrook, 4 years ago)

Added storage type specification for enums.

  • Property svn:eol-style set to native
Line 
1enum Medium
2    of uint64
3    air
4    land
5    water
6
7
8class Aircraft
9
10    def canTravelIn(medium as Medium) as bool
11        return medium == Medium.air  # former bug caused compiler to barf
12
13    def assignSystemEnumResultTypeToLocalVar
14        platform = Environment.osVersion.platform  # former bug. CLR type was not scanned
15        CobraCore.noOp(platform)
16
17    def main is shared
18        assert Aircraft().canTravelIn(Medium.air)
19        assert not Aircraft().canTravelIn(Medium.water)
Note: See TracBrowser for help on using the browser.