问题
In the Haxe programming language, is it possible to detect the target language inside a method definition, as shown here?
class Test {
static function main() {
trace("Hello World !");
#if java
trace("This is compiled to Java");
#elseif js
trace("This is compiled to Javascript");
}
}
回答1:
That should work, you only need to add #end after the last trace.
来源:https://stackoverflow.com/questions/13165731/conditional-compilation-inside-a-method-in-haxe