Haxe中方法内部的条件编译 [英] Conditional compilation inside a method in Haxe

查看:68
本文介绍了Haxe中方法内部的条件编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Haxe编程语言中,是否可以在方法定义中检测到目标语言,如下所示?

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");
    }
}

推荐答案

应该可以,您只需要在最后一次跟踪之后添加#end.

That should work, you only need to add #end after the last trace.

这篇关于Haxe中方法内部的条件编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆