Hello world!

Hello World is a simple program that, when run, outputs or displays “Hello, World!” to the user. Being a very simple program in most programming languages, it is often used to illustrate the basic syntax of a programming language for a working program. In general, it is simple enough to be understood easily, especially with the guidance of a teacher or a written guide.

In addition, “Hello world!” can be a useful sanity test to make sure that a language’s compiler, development environment, and run-time environment are correctly installed. Configuring a complete programming toolchain from scratch to the point where even trivial programs can be compiled and run can involve substantial amounts of work. For this reason, a simple program is used first when testing a new tool chain. A “Hello world!” program running on Sony’s PlayStation Portable as a proof of concept.

“Hello world!” is also used by computer hackers as a proof of concept that arbitrary code can be executed through an exploit where the system designers did not intend code to be executed—for example, on Sony’s PlayStation Portable. This is the first step in using homemade content (“home brew”) on such a device.

“Hello, world.” was used as their first Tweet in 2016 by the previously secretive GCHQ UK communications interception agency.

History

While small test programs existed since the development of programmable computers, the tradition of using the phrase “Hello world!” as a test message was influenced by an example program in the seminal book The C Programming Language. The example program from that book prints “hello, world” (without capital letters or exclamation mark), and was inherited from a 1974 Bell Laboratories internal memorandum by Brian Kernighan, Programming in C: A Tutorial, which contains the first known version:

#include 

main( )
{
        printf("hello, world\n");
}

The C version was adapted from Kernighan’s 1972 A Tutorial Introduction to the Language B, where the first known version of the program is found in an example used to illustrate external variables:

main(){
  extrn a,b,c;
  putchar(a); putchar(b); putchar(c); putchar('!*n');
  }

a 'hell';
b 'o, w';
c 'orld';

The program prints hello, world! on the terminal, including a newline character. The phrase is divided into multiple variables because in B, a character constant is limited to four ASCII characters. The previous example in the tutorial printed hi! on the terminal, and the phrase hello, world! was introduced as a slightly longer greeting that required several character constants for its expression.

It is also claimed that hello, world originated instead with BCPL (1967). This claim is supported by the archived notes of the inventors of BCPL, Prof. Brian Kernighan at Princeton and Martin Richards at Cambridge.

For modern languages, hello world programs vary in sophistication. For example, the Go programming language introduced a multilingual program, Sun demonstrated a Java hello world based on scalable vector graphics, and the XL programming language features a spinning Earth hello world using 3D graphics. While some languages such as Perl, Python or Ruby may need only a single statement to print “hello world”, a low-level assembly language may require dozens of commands. Mark Guzdial and Elliot Soloway have suggested that the “hello world” test message may be outdated now that graphics and sound can be manipulated as easily as text.

2 Comments on "Hello world!"


  1. Hi, this is a comment.
    To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.


  2. It is also claimed that hello, world originated instead with BCPL (1967). This claim is supported by the archived notes of the inventors of BCPL, Prof. Brian Kernighan at Princeton and Martin Richards at Cambridge.

Comments are closed.