Hello Hack

Today I will show you how to execute the famous Hello World program using the Hack programming language.

Below is the code outputs that the string “Hello World!!”

 

Hello World
Hack code for Hello World Program

Now if any of you are familiar with the php language you will say that it looks just like it. You’d be almost correct the header <?hh makes this file a Hack file. One of the neat features of hack is that it can run php code without any modifications what so ever to it. By using <?hh the HHVM(Hip-Hop Virtual Machine) is called upon to execute the commnad(s). All hack files are saved using the .php format.  Next week I’ll explain more about the HHVM and how it makes Hack unique to PHP.

Hello World !
Hello World Program in FireFox Web Browser

One thought on “Hello Hack

  1. You and Matt should keep track of each other’s blog post – he is doing PHP and it might be interesting to see in some future posts both of you doing the same program to show the differences between PHP and Hack. Again, it would be great if you told us how to set up an environment so that we can try out these code snippets ourselves.

    Like

Leave a reply to dan palmer (@profpalmer) Cancel reply