I know very little about the Hack programming language. I don't intend to go far with this language. This document will go over all of my knowledge of the Hack programming language.
This is how you make a Hello World program in Hack:
<<__EntryPoint>>
function main(): void {
echo 'Hello, World!';
}Comments in Hack are the same as in PHP.
Single line comments in Hack are written like so:
<<__EntryPoint>>
// This is a single line commentMulti-line comments in Hack are written like so:
<<__EntryPoint>>
/* This is a
* multi-line
* comment */
/* This is
also a
multi-line
comment
*/break;To this day, I am still not entirely sure what the break keyword does, but most languages support it.
I am not sure if Hack supports the break keyword
/!\ This example has not been tested yet, and may not work
Hack has a shebang line that differentiates it from PHP.
<<__EntryPoint>>Hack supports functions similarly to PHP. An important thing to note is that a function name has to be unique. You cannot use the same function name across multiple files in the same program.
<<__EntryPoint>>
function function2(): void {
echo 'This is a function.';
}Returning a function in Hack is done like so
<<__EntryPoint>>
function function3(): void {
echo 'This is a function. It will be returned.';
}
return function3();-
Hack is a language by Facebook
-
Hack is a semicolon and curly bracket language
-
Hack uses the
*.phpfile extension by default, but also uses the*.hh*.hckand*.hackfile extensions -
Hack is a functional programming language
-
Hack is heavily based on PHP, and works on Facebooks HipHop virtual machine
-
Hack is not one of the top 50 programming languages (as of 2022)
-
Hack was first created in the year 2014
-
No other knowledge of the Hack programming language
-
I don't recognize Facebook (the company) by their 2022 name Meta/Meta platforms, as the name is too generic, and doesn't deserve to be used by them
-
The
*.hhfile extension can be mistaken for a C++ program file, as they both use this extension -
The
*.phpfile extension can be mistaken for a PHP program file, as they both use this extension -
No other additional comments available
File type: Markdown document (*.md *.mkd *.mdown *.markdown)
File version: 2 (2022, Monday, August 1st at 4:35 pm PST)
Line count (including blank lines and compiler line): 190
Click/tap here to expand/collapse the history for this file
Version 1 (2022, Monday, August 1st at 4:26 pm PST)
Changes:
- Started the file
- Added the
titlesection
- Added the
Hello World in Hacksection
- Added the
Comments in Hacksection
- Added the
Single line commentssubsection
- Added the
Multi-line commentssubsection
- Added the
break keyword in Hacksection
- Added the
Shebangs in Hacksection
- Added the
Functions in Hacksection
- Added the
Return Keyword in Hacksection
- Added the
other knowledge of the Hack programming languagesection
- Added the
Additional commentssection
- Added the
file infosection
- Added the
file historysection
- No other changes in version 1
Version 2 (2022, Monday, August 1st at 4:35 pm PST)
Changes:
- Removed remaining references to LOLCode, which this document was based on
- Updated the
file infosection
- Updated the
file historysection
- No other changes in version 2