Coder Social home page Coder Social logo

seanpm2001 / learn-hack Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 280 KB

A repository for showcasing my knowledge of the Hack programming language, and continuing to learn the language.

Home Page: https://github.com/seanpm2001/Learn/

License: GNU General Public License v3.0

Hack 66.96% C++ 33.04%
article collection gpl3 gplv3 hack hack-lang hack-language knowledge learn md

learn-hack's Introduction


/Hack_(programming_language)_logo.svg

Learning Hack (programming language)

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.

Hello World in Hack

This is how you make a Hello World program in Hack:

<<__EntryPoint>>
function main(): void {
  echo 'Hello, World!';
}

Comments in Hack

Comments in Hack are the same as in PHP.

Single line comments

Single line comments in Hack are written like so:

<<__EntryPoint>>
// This is a single line comment
Multi-line comments

Multi-line comments in Hack are written like so:

<<__EntryPoint>>
/* This is a
* multi-line
* comment */
/* This is 
also a
multi-line
comment
*/

Break keyword in Hack

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

Shebangs in Hack

Hack has a shebang line that differentiates it from PHP.

<<__EntryPoint>>

Functions in Hack

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.';
}

Return keyword in Hack

Returning a function in Hack is done like so

<<__EntryPoint>>
function function3(): void {
  echo 'This is a function. It will be returned.';
}
return function3();

Other knowledge of the Hack programming language

  1. Hack is a language by Facebook

  2. Hack is a semicolon and curly bracket language

  3. Hack uses the *.php file extension by default, but also uses the *.hh *.hck and *.hack file extensions

  4. Hack is a functional programming language

  5. Hack is heavily based on PHP, and works on Facebooks HipHop virtual machine

  6. Hack is not one of the top 50 programming languages (as of 2022)

  7. Hack was first created in the year 2014

  8. No other knowledge of the Hack programming language

Additional comments

  1. 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

  2. The *.hh file extension can be mistaken for a C++ program file, as they both use this extension

  3. The *.php file extension can be mistaken for a PHP program file, as they both use this extension

  4. No other additional comments available


File info

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


File history

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 title section
  • Added the Hello World in Hack section
  • Added the Comments in Hack section
  • Added the Single line comments subsection
  • Added the Multi-line comments subsection
  • Added the break keyword in Hack section
  • Added the Shebangs in Hack section
  • Added the Functions in Hack section
  • Added the Return Keyword in Hack section
  • Added the other knowledge of the Hack programming language section
  • Added the Additional comments section
  • Added the file info section
  • Added the file history section
  • 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 info section
  • Updated the file history section
  • No other changes in version 2

learn-hack's People

Contributors

seanpm2001 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

seanwallawalla

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.