Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
"Hello, World!" program
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Variations== [[Image:PSP-Homebrew.jpeg|thumb|A "Hello, World!" program running on Sony's [[PlayStation Portable homebrew|PlayStation Portable]] as a [[proof of concept]]]] "Hello, World!" programs vary in complexity between different languages. In some languages, particularly [[scripting language]]s, the "Hello, World!" program can be written as one statement, while in others (more so many [[Low-level programming language|low-level languages]]) many more statements can be required. For example, in [[Python (programming language)|Python]], to print the string ''{{samp|Hello, World!}}'' followed by a newline, one only needs to write <syntaxhighlight lang="python" inline>print("Hello, World!")</syntaxhighlight>. In contrast, the equivalent code in [[C++]]<ref>{{cite web |url=https://en.wikibooks.org/wiki/C%2B%2B_Programming/Examples/Hello_world |title=C++ Programming/Examples/Hello world |publisher=[[Wikibooks]] |access-date=16 March 2022 |archive-date=28 March 2022 |archive-url=https://web.archive.org/web/20220328130457/https://en.wikibooks.org/wiki/C%2B%2B_Programming/Examples/Hello_world |url-status=live}}</ref> requires the import of the [[C++ standard library]], the declaration of an [[entry point]] (main function), and a call to print a line of text to the standard output stream. [[File:CNC Hello World.jpg|thumb|Computer [[numerical control]] (CNC) machining test in [[poly(methyl methacrylate)]] (Perspex).]] The phrase "Hello, World!" has seen various deviations in casing and punctuation, such as "hello world" which lacks the capitalization of the leading ''H'' and ''W'', and the presence of the comma or exclamation mark. Some devices limit the format to specific variations, such as all-capitalized versions on systems that support only capital letters, while some [[esoteric programming language]]s may have to print a slightly modified string. Other human languages have been used as the output; for example, a tutorial for the [[Go (programming language)|Go language]] emitted both English and Chinese or Japanese characters, demonstrating the language's built-in [[Unicode]] support.<ref>[http://golang.org/doc/go_tutorial.html#tmp_20 A Tutorial for the Go Programming Language.] {{webarchive |url=https://web.archive.org/web/20100726052120/http://golang.org/doc/go_tutorial.html#tmp_20 |date=26 July 2010}} The Go Programming Language. Retrieved 26 July 2011.</ref> Another notable example is the [[Rust (programming language)|Rust language]], whose management system automatically inserts a "Hello, World" program when creating new projects. [[File:HelloWorld Maktivism ComputerProgramming LEDs.jpg|thumb|A "Hello, World!" message being displayed through long-exposure [[light painting]] with a moving strip of [[light-emitting diode]]s (LEDs)]] Some languages change the function of the "Hello, World!" program while maintaining the spirit of demonstrating a simple example. [[Functional programming]] languages, such as [[Lisp (programming language)|Lisp]], [[ML (programming language)|ML]], and [[Haskell]], tend to substitute a [[factorial]] program for "Hello, World!", as functional programming emphasizes recursive techniques, whereas the original examples emphasize I/O, which violates the spirit of pure functional programming by producing [[Side effect (computer science)|side effects]]. Languages otherwise able to print "Hello, World!" ([[assembly language]], [[C (programming language)|C]], [[VHDL]]) may also be used in [[embedded system]]s, where text output is either difficult (requiring added components or communication with another computer) or nonexistent. For devices such as [[microcontroller]]s, [[field-programmable gate array]]s, and [[complex programmable logic device]]s (CPLDs), "Hello, World!" may thus be substituted with a blinking [[light-emitting diode]] (LED), which demonstrates timing and interaction between components.<ref>{{cite web|last1=Silva|first1=Mike|title=Introduction to Microcontrollers - Hello World|url=http://www.embeddedrelated.com/showarticle/460.php|website=EmbeddedRelated.com|access-date=19 May 2015|date=11 September 2013|archive-date=22 May 2015|archive-url=https://web.archive.org/web/20150522081938/http://www.embeddedrelated.com/showarticle/460.php|url-status=live}}</ref><ref>{{cite web|last1=George|first1=Ligo|title=Blinking LED using Atmega32 Microcontroller and Atmel Studio|url=https://electrosome.com/blinking-led-atmega32-avr-microcontroller/|website=electroSome|date=8 May 2013|access-date=19 May 2015|archive-date=5 November 2014|archive-url=https://web.archive.org/web/20141105123532/http://electrosome.com/blinking-led-atmega32-avr-microcontroller|url-status=live}}</ref><ref>{{cite web|last1=PT|first1=Ranjeeth|title=2. AVR Microcontrollers in Linux HOWTO|url=http://www.tldp.org/HOWTO/Avr-Microcontrollers-in-Linux-Howto/x207.html|website=The Linux Documentation Project|access-date=19 May 2015|archive-date=2 May 2015|archive-url=https://web.archive.org/web/20150502194301/http://www.tldp.org/HOWTO/Avr-Microcontrollers-in-Linux-Howto/x207.html|url-status=live}}</ref><ref>{{cite web|last1=Andersson|first1=Sven-Åke|title=3.2 The first Altera FPGA design|url=http://www.rte.se/blog/blogg-modesty-corex/first-altera-fpga-design/3.2|publisher=Raidió Teilifís Éireann|access-date=19 May 2015|date=2 April 2012|archive-url=https://web.archive.org/web/20150521222132/http://www.rte.se/blog/blogg-modesty-corex/first-altera-fpga-design/3.2|archive-date=21 May 2015|url-status=dead}}</ref><ref>{{cite web|last1=Fabio|first1=Adam|title=CPLD Tutorial: Learn programmable logic the easy way|url=http://hackaday.com/2014/04/06/cpld-tutorial-learn-programmable-logic-the-easy-way/|website=Hackaday|access-date=19 May 2015|date=6 April 2014|archive-date=20 May 2015|archive-url=https://web.archive.org/web/20150520063507/http://hackaday.com/2014/04/06/cpld-tutorial-learn-programmable-logic-the-easy-way/|url-status=live}}</ref> The [[Debian]] and [[Ubuntu]] [[Linux distribution]]s provide the "Hello, World!" program through their [[Package manager|software package manager]] systems, which can be invoked with the command ''{{samp|hello}}''. It serves as a [[sanity check]] and a simple example of installing a software package. For developers, it provides an example of creating a [[.deb]] package, either traditionally or using ''debhelper'', and the version of {{samp|hello}} used, [[GNU Hello]], serves as an example of writing a [[GNU]] program.<ref>{{cite web|title=Hello |url=https://www.gnu.org/software/hello/|website=GNU Project |publisher=Free Software Foundation |access-date=7 July 2017|archive-url=https://archive.today/20140529011826/http://www.gnu.org/software/hello/|archive-date=29 May 2014|url-status=dead}}</ref> Variations of the "Hello, World!" program that produce a [[Computer graphics|graphical output]] (as opposed to text output) have also been shown. [[Sun Microsystems|Sun]] demonstrated a "Hello, World!" program in [[Java (programming language)|Java]] based on [[scalable vector graphics]],<ref>{{cite news|last=Jolif|first=Christophe|title=Bringing SVG Power to Java Applications|newspaper=Sun Developer Network|date=January 2003}}</ref> and the [[XL (programming language)|XL]] programming language features a spinning Earth "Hello, World!" using [[3D computer graphics]].<ref>{{cite web|last=de Dinechin|first=Christophe|title=Hello world!|url=http://grenouillebouillie.wordpress.com/2010/07/24/hello-world/|publisher=Grenouille Bouillie|date=24 July 2010}}</ref> 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.<ref>{{cite web|url=http://www.bfoit.org/itp/Soloway/CACM_Nintendo_Generation.pdf|title=Teaching the Nintendo Generation to Program|website=bfoit.org|access-date=27 December 2015|archive-url=https://web.archive.org/web/20160505190520/http://www.bfoit.org/itp/Soloway/CACM_Nintendo_Generation.pdf|archive-date=5 May 2016|url-status=dead}}</ref> In [[computer graphics]], rendering a triangle{{snd}}called "Hello Triangle"{{snd}}is sometimes used as an introductory example for [[Graphics library|graphics libraries]].<ref>{{Cite book |last=Vries |first=Joey de |title=Learn OpenGL - Graphics Programming |date= |publisher=Kendall & Welling |year=2020 |isbn=978-90-90-33256-7 |pages=26}}</ref><ref>{{cite magazine|magazine=[[The MagPi]]|issue=65|date=Jan 2018|title=Coding games on the Raspberry Pi in C/C++ Part 01|page=57|quote=next time we will expand our code to start working with graphics and the famous 'hello triangle' code that absolutely no one uses except game coders|first1=Brian|last1=Beuken}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)