Skip to content

Instantly share code, notes, and snippets.

@devboy
Forked from alecmce/enum.hx
Created October 30, 2011 21:43
Show Gist options
  • Save devboy/1326483 to your computer and use it in GitHub Desktop.
Save devboy/1326483 to your computer and use it in GitHub Desktop.
Haxe Enum Example
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