Haxe - Print command line arguments

别等时光非礼了梦想. 提交于 2020-04-07 03:43:49

问题


Using the Haxe programming language, is it possible to print the command line arguments that are passed to an application?

I'm trying to re-write this Java program (which simply prints the command line arguments) in Haxe.

public class JavaExample{
    public static void main(String[] args){
        for(int i = 0; i < args.length; i++){
            System.out.println(args[i]);
        }
    }
}

回答1:


Since targets like JS(in browser) and Flash do not have concept of command line arguments. Haxe put such "system" target things in Sys and the top level sys package.

class Example {
    public static function main():Void {
        for (arg in Sys.args())
            Sys.println(arg);
    }
}


来源:https://stackoverflow.com/questions/13132781/haxe-print-command-line-arguments

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