A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
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.
<?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.
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
<?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.
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.