The following program prints "Hello World" after being compiled and run:
/** Multi-line comments for documentation. **/ class Main { static public function main():Void { // Single line comment trace("Hello World"); } }
This can be tested by saving the above code to a file named Main.hx and invoking the Haxe Compiler like so: haxe -main Main --interp. It generates the following output: Main.hx:3: Hello world. There are several things to learn from this:
.hx.-main Main and --interp.Main, upper-case), which have functions (main, lower-case). Main.hx).