本文介绍了Haxe-打印命令行参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Haxe编程语言,是否可以打印传递给应用程序的命令行参数?
Using the Haxe programming language, is it possible to print the command line arguments that are passed to an application?
我试图用Haxe重写此Java程序(仅打印命令行参数).
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]);
}
}
}
推荐答案
由于JS(在浏览器中)和Flash等目标没有命令行参数的概念. Haxe将这样的系统"目标对象放在 Sys 和顶级sys程序包中.
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);
}
}
这篇关于Haxe-打印命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!