Hello World in Hack

Published on (Updated: 02 May 2020)

Welcome to the Hello World in Hack page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

<?hh
echo "Hello, World!";

Hello World in Hack was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

At long last, let's take a stab at Hello World in Hack.

Right away, you should scream "that looks a lot like PHP!" After all, Hack is just a dialect of PHP.

That said, there is at least one obvious syntactic difference: the Hack tag. I can't seem to figure out the formal name of the <?hh tag, so I've been calling it the Hack tag. At any rate, at least that's different.

Beyond the tag, Hello World in Hack is exactly the same in Hello World in PHP. However, I will point out that you can't mix HTML with Hack like you can with PHP, so that's probably the biggest syntactic difference. Otherwise, both languages perform a similar function: backend web development.

How to Run the Solution

If we want to try this code, we can use an online Hack compiler.

Alternatively, we can download the Hack Virtual Machine to run Hack code locally. From there, I recommend reading up on how to get started with Hack. Getting everything up and running is bit out of scope of this article.