Hello, World! The Story Behind Programming's First Line
The phrase almost every programmer types first has a more layered history than the usual telling suggests, and it didn't start where most articles say it did.
Where the line actually comes from
Type print("Hello, World!") into a fresh terminal and you're repeating an experiment that started more than fifty years ago at Bell Labs.
In 1972, Brian Kernighan wrote an internal memo called A Tutorial Introduction to the Language B, meant to help colleagues learn a language he and Ken Thompson had built. Buried in that memo is the earliest known version of the phrase, used to show that the language could assemble a short piece of text and print it.
The line resurfaced a few years later in another Bell Labs document, this time for the language that grew out of B: C. It wasn't until 1978, when Kernighan and Dennis Ritchie published The C Programming Language, that the example reached a wide audience and became the default first program for an entire generation of coders. The book gets the credit, but the memo did the inventing.
Why a greeting, and not something else
Kernighan needed an example short enough to type from memory and simple enough that any reader could tell, at a glance, whether it had worked. A friendly greeting did that better than a column of numbers or a raw memory dump ever could.
To run, a program like this has to manage three unglamorous jobs: hold a short piece of text in memory, send it to an output device, and shut down cleanly once it's done. Nearly every language now folds that entire sequence into a single line, which is a big part of why the example survived.
Kernighan and Ritchie later put it plainly in their own book: the real way to learn a language is to sit down and actually write in it.
From punch cards to a single keystroke
On a 1960s mainframe, seeing those words appear meant punching a stack of cards, feeding them into a reader, and waiting for a teletype to clatter out a line of text minutes later. On a phone today, the same result shows up the instant you tap run.
The idea has even reached hardware with no screen at all. A microcontroller running its own version might blink an LED instead of printing text, but the goal hasn't changed: confirm that the compiler, the linker, and the chip are actually talking to each other before anything more complicated gets built.
Why professionals still bother with it
- Environment check. Confirms libraries, dependencies, and build tools are wired up correctly before real work starts.
- Debugging baseline. If this fails, the problem lives in the setup, not in your logic.
- Shared reference. Tutorials lean on it because nearly every reader already recognizes the pattern.
None of that requires much sophistication. That's the point. In a field that reinvents its tooling every few years, one plain sentence has stayed reliable enough to trust.
One idea, countless accents
Some languages turn the exercise into a small puzzle. Writing it in Brainfuck takes over a thousand characters of looping symbols before a single letter appears. Python needs one line:
print("Hello, World!")
Set the two side by side and you get a fast lesson in what a language's design actually costs a beginner.
Give it a try
Open a language you've never touched, find its REPL, and type the line yourself. If the words show up, you've just repeated an experiment that's been running since 1972. If they don't, you've found your first bug, and that's a fine place to start too.
WeWillExplain. Turning confusion into clarity, one explainer at a time.
Discussion
Sign in to join the discussion.
Sign in