I know there is this question Constants in Haxe about class properties. My question is: is it possible to define constants inside functions? Like:
function foo(){
const bar=7;
bar = 8; // should prevent compilation
}
Maybe anything like var var foo:ReadOnlyInt
or something?
You're looking for final
.
function foo() {
final bar = 7;
bar = 8; // not allowed
}