Haxe Programming/Basic

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Target Platforms[edit | edit source]

Below is a list of all of the platforms Haxe supports:

Targets
Name
Flash
Neko
JavaScript
ActionScript 3
PHP
C++
Java
C#
Python


"Hello, World!"[edit | edit source]

First off, we are going to write a "Hello, World!" program. This way of printing applies to all targets.

class Hello {
    static function main() {
        trace("Hello, World!");
    }
}

This code can then be interpreted by saving the file as Main.hx, then by using the command haxe -main Main --interp in any command-line.