Open utterances-bot opened 5 years ago
I think it's worth mentioning, that in most of cases you don't have to prefix the constructor name with the type name. If the enum type is imported or known to be the expected type, you can write e.g. Shield
directly instead of ItemType.Shield
. That will remove some redundant repetitions. I think this is especially useful in pattern matching!
var enumConstructorNames = ItemType.getNames(); => var enumContructorNames = ItemType.getConstructors();
Using enum / ADT - Beginner - Haxe programming language cookbook
Haxe's enumeration types are algebraic data types. Their primary use is for describing data structures.
https://code.haxe.org/category/beginner/enum-adt.html