12.4.1 Getting started with Haxe/Neko

To get started with Haxe/Neko, create a new folder and save this class as Main.hx.

/**
    Multi-line comments for documentation.
**/
class Main {
    static public function main():Void {
        // Single line comment
        trace("Hello World");
    }
}

To compile, either run the following from the command line:

haxe --neko hello.n --main Main

Another possibility is to create and run (double-click) a file called compile.hxml. In this example the hxml file should be in the same directory as the example class.

--neko hello.n
--main Main

The compiler outputs a binary file called hello.n in the current folder, which can be executed with neko hello.n from the command line.