In haxe, we can use guards in switch cases (as documented in the Haxe Manual.
This example code from there:
var myArray = [7, 6];
var s = switch (myArray) {
case [a, b] if (b > a):
b + ">" + a;
case [a, b]:
b + "<=" + a;
case _: "found something else";
}
trace(s); // 6<=7
would return 6<=7 back
But in polymod this isn't supported and errors with this:
ERROR Error while parsing script assets/scripts/WorstCParser.hxc#8: EUnexpected
Unexpected error: Unexpected token "if", is there invalid syntax on this line?