Hex constants
2 answers
The usual way to declare a constant in Haxe is to use static inline
modifiers.
class Test {
public static inline var CONSTANT = 1;
static function main() {
trace(CONSTANT);
trace(Test.CONSTANT);
}
}
look at try.haxe.org .
+16
source to share
For non-static variables and objects, you can give them a shallow constant like below:
public var MAX_COUNT(default, never):Int = 100;
This means that you can read the default, but you cannot "write" to it.
More information can be found at http://adireddy.github.io/haxe/keywords/never-inline-keywords .
+5
source to share