Anderson Green
Anderson Green

Reputation: 31800

Equivalent of Java Scanner class in Haxe

In the Haxe programming language, is there anything equivalent to Java's scanner class (which reads input from the command line?) I'd like to find some way of reading text input from the command line.

Upvotes: 1

Views: 156

Answers (1)

Jason O'Neil
Jason O'Neil

Reputation: 6008

Sys.stdin().readLine() is what you're looking for.

Here's an example from http://haxe.org/doc/start/neko#reading-user-input:

class Main {
    static function main() {
        Sys.println("What's your name?");
        var input = Sys.stdin().readLine();
        Sys.println(Std.format("Hello ${input}"));
        Sys.exit(0);
    }
}

Upvotes: 2

Related Questions