Hello World!
Tags: c, java, esolangs, scala
Published: 2018-10-21 21:47:39

A _Hello world!_ program is a bit of code that prints the string "Hello world!" to the terminal / output / etc. In most languages, this is a straightforward and boring task:

# C
```cpp
#include <stdio.h>
int main() {
  printf("Hello world!\n");
  return EXIT_SUCCESS;
}
```

# C++
```cpp
#include <iostream>
int main() {
  std::cout << "Hello world!\n";
}
```

# Java
```java
class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello world!");
  }
}
```

# Scala
```scala
object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello world!")
  }
}
```

-----

There are hundreds more examples at [rosettacode.org](https://rosettacode.org/wiki/Hello_world/Text). Some of my favourites (and I think [the most interesting ones](https://en.wikipedia.org/wiki/Esoteric_programming_language)) include:

# Beeswax
[Beeswax](https://esolangs.org/wiki/Beeswax) is a 2-dimensional programming language in which "bees" (instruction pointers) move around a hexagonal grid of characters, picking up values from the global stack and manipulating them on their own "personal" (local) fixed-size (3 * UInt64) stack. Bees can pick up values from anywhere, modify them, and drop them anywhere in the source code, allowing for self-modifying code. A _Hello world!_ program in Beeswax might look like:

```
 W o    l   `
  ``     e  H
  `*`r`#`l`_`ld!
   ``      \/
   , o
```

This could much more easily be written as

```
 _`Hello, World!
```

But what's the fun in that?

# Chef
Chef is a programming language designed to look like a recipe. Programs consist of "wet" and "dry" "ingredients" that can be mixed, stirred, liquefied, and combined together. Mike Worth [has developed a recipe](http://www.mike-worth.com/2013/03/31/baking-a-hello-world-cake/) for a _Hello world!_ chocolate cake, written in Chef, which also is a decent recipe for IRL chocolate cake:

```
Hello World Cake with Chocolate sauce.

This prints hello world, while being tastier than Hello World Souffle. The main
chef makes a " world!" cake, which he puts in the baking dish. When he gets the
sous chef to make the "Hello" chocolate sauce, it gets put into the baking dish
and then the whole thing is printed when he refrigerates the sauce. When
actually cooking, I'm interpreting the chocolate sauce baking dish to be
separate from the cake one and Liquify to mean either melt or blend depending on context.

Ingredients.
33 g chocolate chips
100 g butter
54 ml double cream
2 pinches baking powder
114 g sugar
111 ml beaten eggs
119 g flour
32 g cocoa powder
0 g cake mixture

Cooking time: 25 minutes.

Pre-heat oven to 180 degrees Celsius.

Method.
Put chocolate chips into the mixing bowl.
Put butter into the mixing bowl.
Put sugar into the mixing bowl.
Put beaten eggs into the mixing bowl.
Put flour into the mixing bowl.
Put baking powder into the mixing bowl.
Put cocoa  powder into the mixing bowl.
Stir the mixing bowl for 1 minute.
Combine double cream into the mixing bowl.
Stir the mixing bowl for 4 minutes.
Liquify the contents of the mixing bowl.
Pour contents of the mixing bowl into the baking dish.
bake the cake mixture.
Wait until baked.
Serve with chocolate sauce.

chocolate sauce.

Ingredients.
111 g sugar
108 ml hot water
108 ml heated double cream
101 g dark chocolate
72 g milk chocolate

Method.
Clean the mixing bowl.
Put sugar into the mixing bowl.
Put hot water into the mixing bowl.
Put heated double cream into the mixing bowl.
dissolve the sugar.
agitate the sugar until dissolved.
Liquify the dark chocolate.
Put dark chocolate into the mixing bowl.
Liquify the milk chocolate.
Put milk chocolate into the mixing bowl.
Liquify contents of the mixing bowl.
Pour contents of the mixing bowl into the baking dish.
Refrigerate for 1 hour.
```

# HQ9+
HQ9+ ([as mentioned in this previous post](https://dev.to/awwsmm/worlds-smallest-quine-guaranteed-b5m)) is an esoteric programming language with only four commands:

 * _H_: prints "Hello, world!"
 * _Q_: prints the source code of the program (a quine)
 * _9_: prints the lyrics of the song "99 bottles of beer"
 * _+_: increments an inaccessible accumulator (essentially does nothing)

The language is not Turing complete, and an interpreter for it can be written in [less than 300 bytes](https://codegolf.stackexchange.com/questions/12956/creating-a-hq9-interpreter) of Haskell code.

# Jacquard Loom
Charles Babbage's [Analytical Engine](https://en.wikipedia.org/wiki/Analytical_Engine), proposed (though never built, unfortunately) in 1837 would have been the first general-purpose, Turing-complete computer. It was designed to work with base-10 (decimal) numbers, unlike modern binary computers, and it would have been entirely mechanical -- the "memory" of the computer is encoded in the physical state of wheels in their axes. The Analytical Engine was designed to be programmed with punch cards, inspired by [Joseph Marie Jacquard's machine](https://en.wikipedia.org/wiki/Jacquard_loom) for automating weaving patterns in looms. [In an entirely mechanical process](http://www.vam.ac.uk/content/videos/j/video-jacquard-weaving), these punch cards can be used to "program" the weave pattern on a loom. The following sequence of cards weaves the string "Hello world!" on a Jacquard-style loom:

```
+---------------+
|               |
|    *    *     |
|*   *    *  *  |
|*           * *|
|*           * *|
|*  *         * |
|   *     *   * |
|         *     |
+---------------+

+---------------+
|               |
|*   *    *     |
|*   *    *     |
|            * *|
|            * *|
|*  *         * |
|*  *     *   * |
|         *     |
+---------------+

+---------------+
|               |
|*   **   * *   |
|*******  *** * |
| **** *   * ***|
| **** *  ******|
| ******   ** * |
|   * *   *   * |
|         *     |
+---------------+

+---------------+
|               |
|*******  *** * |
|*******  *** * |
|           ** *|
|*        *  * *|
|*******   ** * |
|*******  *** * |
|         *     |
+---------------+

+---------------+
|               |
|*******  *** * |
|*******  *** * |
|      *  *  * *|
|      *  *  * *|
|*******  **  * |
|*******  **  * |
|         *     |
+---------------+

+---------------+
|               |
|***** *  *** * |
|*******  *** * |
|     * * *  *  |
|     * *    *  |
|******   **  * |
|******   **  * |
|         *     |
+---------------+

+---------------+
|               |
|    *    * *   |
|***** *  ***** |
|***** **  * ***|
|***** **  * ***|
|*******   * ** |
|   * *   *   * |
|         *     |
+---------------+

+---------------+
|               |
|               |
|     * *       |
|     * *       |
|     *         |
|     *         |
|               |
|               |
+---------------+
```

# LOLCODE
Inspired by the LOLcats memes of the mid-00s, [LOLCODE](https://en.wikipedia.org/wiki/LOLCODE) is a programming language with keywords like `KTHX` and `BTW`. A _Hello world!_ LOLCODE program could be written as:

```
HAI 1.2
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
```

Despite the fact that LOLCODE interpreters and compilers have been written in languages like .NET, JavaScript, and Python, and that [a version of the language has been written for distributed / parallelised](https://www.parallella.org/2017/04/01/parallel-and-distributed-computing-with-lolcode) computing, it is still a joke language, and bugs and redundancies exist. For example, in the code above, the version (1.2) is unnecessary and mostly ignored, as is the second line, which is meant to import an IO library. A LOLCODE interpreter is available at [https://repl.it/repls/ExtrasmallWastefulFolders](https://repl.it/repls/ExtrasmallWastefulFolders).

# உயிர் / Uyir
உயிர் (Uyir) is the [Tamil](https://en.wikipedia.org/wiki/Tamil_language) word for "life force", "soul", or "vitality" (according to [Google translate](https://translate.google.com/#auto/en/%E0%AE%89%E0%AE%AF%E0%AE%BF%E0%AE%B0%E0%AF%8D)), and is currently under development. Its goal is to be the first _omniglot_ programming language, where keywords, commands, etc. can be written and understood by the interpreter / compiler in any human language. At the moment, it seems to work only in Tamil, though. Note that [there are many programming languages](https://en.wikipedia.org/wiki/Non-English-based_programming_languages) with keywords based on languages other than English, some with non-ASCII character sets (丙正正, ΓΛΩΣΣΑ, *قلب* ), and several that have no language-specific keywords at all (APL, Brainfuck, Piet, Whitespace, etc.).

_This post originally appeared in a slightly different form on my (now defunct) Wordpress blog._