Time for action – Writing a Hello World

Let's create an application that will simply display the "Hello World" message. We will use only cross-platform code and will compile it to neko to begin.

  1. Copy the following code in a file named Main.hx
    class Main
    {
       public static function main()
       {
          trace("Hello World");
       }
    }

    Tip

    Downloading the example code for this book

    You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

  2. Open a terminal; go to the directory where you saved Main.hx and type the haxe –main Main –neko helloworld.n command.
  3. Type this command: ...

Get haXe 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.