Wednesday, June 24, 2015

Hello World! -Haxe

Hello World! Haxe

Lets meet haxe, and follow the opening part of the tutorial from here.

if you haven't install haxe yet, follow the installation steps here.

Open terminal

Create file Hello.hx

$ nano Hello.hx

Type in the following source code :

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

To compile, run the following command:

$ haxe -main Hello -neko Hello.n

This will create new file Hello.n
To run the file, type:

$ neko Hello.n

Hello.hx:3: Hello World!!


Basic Neko API

From http://api.haxe.org/neko/Lib.html#println :
"Print the specified value on the default output followed by a newline character."

Lets modified the Hello.hx

$ nano Hello.hx

class Hello {
      public static function main () {
           neko.Lib.println("Hello World!!");
      }
}

Save the file.
Compile it

$ haxe -main Hello -neko Hello.n

then run the file

$ neko Hello.n



Hey.. it's working!

No comments:

Post a Comment