Created
October 30, 2011 21:40
-
-
Save alecmce/1326479 to your computer and use it in GitHub Desktop.
Haxe Enum Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum MyEnum | |
{ | |
first; | |
second; | |
third(param:MyParam); | |
} | |
class MyClass | |
{ | |
private var _state:MyEnum; | |
public function triggerThird(param:MyParam):Void | |
{ | |
_state = third(param); | |
} | |
public function test():Void | |
{ | |
switch (_state) | |
{ | |
case first: | |
trace("first"); | |
case second: | |
trace("second"); | |
case third(param): | |
trace("third: " + param); | |
} | |
} | |
} |
I get the same error than you using enums with parameters.
Did you find any answer 2 years later ? :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get the error "Unknown identifier : param" on line 25... :(