Hello world program
Encyclopedia : H : HE : HEL : Hello world program
A "hello world" program is a software program that prints out "Hello, world!" on a display device. It is used in many introductory tutorials for teaching a programming language and many students use it as their first programming experience in a language.
Such a program is typically one of the simplest programs possible in a computer language. Some, however, are surprisingly complex, especially in some graphical user interface (GUI) contexts; but most are very simple, especially those which rely heavily on a particular command line interpreter ("shell") to perform the actual output. In many embedded systems, the text may be sent to a one or two-line liquid crystal display (LCD) (and in yet other systems, a simple LED being turned on may substitute for "Hello world!").
A "hello world" program 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 may involve substantial amounts of work. For this reason, a simple program is used first when testing a new tool chain.
While small test programs existed since the development of programmable computers, the tradition of using the phrase "Hello world!" as the test message was influenced by an example program in the book The C Programming Language, by Brian Kernighan and Dennis Ritchie, published in 1978. The example program from that book prints "hello, world" (i.e., no capital letters, no exclamation sign; those entered the tradition later). The book had inherited the program from a 1974 Bell Laboratories internal memorandum by Kernighan —Programming in C: A Tutorial— which shows the first known version of the program:
main()
However, the first known instance of the usage of the words "hello" and "world" together in computer literature occurred in A Tutorial Introduction to the Language B, by Brian Kernighan, 1972 [link], with the following code:
main( ) a 'hell'; b 'o, w'; c 'orld';
There are many variations on the punctuation and casing of the phrase, and the examples on this page print out several of these variations. Variations include the presence or lack of the comma and exclamation mark, and the capitalisation of the 'H', both 'H' and 'W', or neither. The most commonly accepted variation, despite not being the original text, is "Hello, world!" Some languages are forced to implement different forms, such as "HELLO WORLD!," on systems that only support capital letters, while many "hello world" programs in esoteric languages print out a slightly modified string. For example, the Malbolge program prints "HEllO WORld", this having been determined to be "good enough." "Hello world" programs also normally print a newline (ASCII character 10, character 13, or both).
See also
- List of hello world programs
- Hello world program in esoteric languages
- Fibonacci number program
- Trabb Pardo-Knuth algorithm
- Just another Perl hacker
- List of basic computer science topics
- Hello, Sailor
External links
- [ACM "Hello World" project]
- ["HelloWorld online on Web, and steps beyond HelloWorld"]
- [Another Collection of Hello World Programs] with 260+ programs, including "Hello World" in several human languages
- http://www.99-bottles-of-beer.net/ 99 bottles ... over 900 programming languages used ...
- [Bootable hello world program for i386 machines]
- Humor:
- *[from rec.humor.funny]
- *[from the GNU Humor Collection]
- *[AsH] - Hola mundo (Spanish)
- Artistic work:
- *[A visual code for Google Earth]
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
