'Hello World!' - Programming Tradition Content from the guide to life, the universe and everything

'Hello World!' - Programming Tradition

2 Conversations

A 1983 Atari 800 home computer PC.

Since the 1970s, it has become customary when learning a new programming language or testing an unfamiliar programming environment to write a 'Hello world!' program with which to do so. This is a program that, quite simply, displays the words 'Hello world!' as output on the computer screen1. Although, due to the syntax of some languages, a 'Hello world!' program can sometimes appear quite complex, it's generally regarded as the simplest type of program that can be executed in a given language.


The first recorded appearance of 'Hello world!' in a programming example was in 1972, in A Tutorial Introduction to the Language B by BW Kernighan. B was a precursor to the longer lasting and better known language C. Kernighan used the following example to illustrate a point about 'external variables':

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

This was just an isolated example. Kernighan could've just as easily used 'look, a bus!'2 to illustrate his point and no-one would have noticed. However, in 1978, Kernighan and co-author Dennis Ritchie wrote a book called The C Programming Language, still considered to be the authoritative reference on the language behind the UNIX operating system, among other things. In the very first section of the book, Kernighan and Ritchie used 'Hello world!' to explain how to write, compile and run a C program:

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

The C Programming Language was considered such a good example of technical writing that its style was emulated by successive authors of programming manuals. Many imitated Kernighan and Ritchie's use of 'Hello world!' as an initial sample program. It's become a handy tool. As The C Programming Language demonstrated, a program that's very straightforward logically and does only one basic thing can then be used to teach someone how to use the language's syntax and other components such as its compiler.

Today, variants of 'Hello world!' are in use in just about every introduction to programming, whether in a book, website or classroom. 'Hello world!' is often the source of computer geek jokes and cultural references. Unless the computing world suddenly decides to convert to 'look, a bus!', there's every reason to believe 'Hello world!' will be around for years to come.


What follows are some examples of 'Hello world!' in a few common programming languages. This is only a minuscule sampling of the range of 'Hello world!'.


10 PRINT "Hello world!"

C (as mentioned above)

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


main() { cout << "Hello world!" << endl; return 0; }


<HTML> <BODY> Hello world! </BODY> </HTML>


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


<html> <body> <script language="JavaScript" type="text/javascript"> document.write('Hello world!'); </script> </body> </html>


<?php echo 'Hello world!'; ?>


print "Hello world!"

UNIX Shell

echo 'Hello world!'

And, of course...


<GUIDE> <BODY> <P>Hello world!</P> </BODY> </GUIDE>
1Opinion is divided on whether there should be an exclamation mark at the end of the phrase, a comma after 'hello', and if either or both of the words should be capitalised, lower case or mixed case. This entry will stick to the convention of 'Hello world!'2For the purpose of a random example.

Bookmark on your Personal Space

Edited Entry


Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry

Categorised In:

Written by

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more