Hello world program
From Free net encyclopedia
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.
Introduction
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( ) { printf("Hello, world!"); }
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, 1973 [1], with the following code:
main( ) { extrn a, b, c; putchar(a); putchar(b); putchar(c); putchar('!*n'); } 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).
Another known satirical variation is "Goodbye, cruel world", which has a slightly suicidal tone.
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 200+ programs, including "Hello World" in several human languages
- http://www.99-bottles-of-beer.net/ 99 bottles ... over 900 programming languages used ...
- smaller one site "mirror" of the very impressive site 99 bottles site mentioned above
- A bunch of Visual FoxPro way to write a Hello World program
- Bootable hello world program for i386 machines
- Humor:
bg:Hello, world ca:Hola món cs:Hello world da:Hello world-program de:Hallo-Welt-Programm et:Hello world es:Hola mundo eu:Kaixo mundua fr:Hello world ko:Hello world 프로그램 id:Hello world ia:Hello World it:Hello world he:תוכנית Hello world hu:Helló, Világ!-program nl:Hello world ja:Hello world no:Hello, world nn:Hello World pl:Hello world pt:Programa Olá Mundo ro:Program Hello, world! ru:Программа Hello world simple:Hello world program sk:Hello world sl:PozdravljenSvet sv:Hello, World! th:Hello world vi:Chào thế giới! zh:Hello World程序