Conditional compilation inside a method in Haxe

﹥>﹥吖頭↗ 提交于 2019-12-24 15:40:54

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!