-
-
Save devboy/1326483 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); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment