r/learnpython • amateur; started learning cuz i was bored in quarantine • Mar 23 '20

Why do all programming languages start with "Hello World"?

like, it can be anything. it can be print("Hi") but no, every teacher, every lesson, every website, teaches you "Hello World". why?? is it just a programmer meme or smth?

414 Upvotes

91 comments sorted by

304

u/K900_ SRE person // please don't DM me your questions Mar 23 '20

It is a "programmer meme", yes. AFAICT it comes from K&R C, one of the most influential programming books ever written.

157

u/OG_Panthers_Fan Mar 23 '20

The first email I ever sent, in a class on learning how to email (really), back in 1992, was "Hello, World!".

The programmers laughed.

The second was "Watson, come here. I need you."

The third (seriously, why do we need this much training) was: "What hath God wrought?"

52

u/doublejay1999 Mar 23 '20

Fascinating how it seems to be getting lost in the midsts of time. I’d bet 20 years ago more would have known this.

55

u/RoamingFox Mar 23 '20

Just like what the save icon is actually a picture of.

66

u/skellious Mar 23 '20

"hey, cool, you 3D printed the save icon!"

"... that's a floppy disk."

11

u/xelf Elf Mar 23 '20

*mists (don't feel bad, this is a common one to mix up), think of it this way "midsts" is generally locational, and used to indicate being between things. "Mists" is used for when something is being obscured.

-1

u/skuhduhduh Mar 24 '20

Both work though so

3

u/xelf Elf Mar 24 '20

I suppose if you're a time traveler you could be lost in the midsts of time, for the rest of us that only travel time in one direction though, something that's lost in time is usually referring to being lost in obscurity. =D =D =D

3

u/skuhduhduh Mar 24 '20

I mean, who doesnt trap themselves in a black hole every once in a while?

2

u/[deleted] Mar 24 '20

Won't be long the phone icon will be that way to.

0

u/[deleted] Mar 23 '20

[deleted]

14

u/DoctroSix Mar 23 '20

There was a 'B' programming language?!?! Was there an 'A' ?

1

u/irrelevantPseudonym Mar 24 '20

Named after Bell labs where it was developed I think. C was the language that aimed to replace it by being "one better" so to speak.

1

u/Gullible_Buffalo_936 Mar 18 '25

There was an A+ language.

1

u/Zovanget Aug 22 '25

Before B there was BCPL. Which itself was derived from CPL. Originally CPL stood for Cambridge Programming Language, later called Combined Programming Language. BCPL was also made in Cambridge so the B might have stood for Bootstrap. But based on BCPL, Ken Thompson in Bell Labs created B. Dennis Ritchie then used it to make C. So no A.

2

u/greebo42 Mar 23 '20

ah, TIL ... I personally recall it from when I first read K&R back in the early 1980s. I knew about predecessors of C (such as B) but never thought to search sources earlier than the book I had in hand.

74

u/[deleted] Mar 23 '20

It's far less depressing than Goodbye World.

1

u/HARLYRC Sep 03 '26

Hay una canción famosa que se llama "good bye to a world" y creo que puede estar relacionado 

0

u/[deleted] Mar 23 '20

[deleted]

3

u/[deleted] Mar 23 '20

Yes yes it is

28

u/AdventurousAddition Mar 23 '20

It most definitely is a programmer meme. It dates back to the K&R C book from the '70s which included the line

printf("Hello, World!\n");

16

u/xelf Elf Mar 23 '20

Or more exactly:

printf("hello, world\n");

(I have a copy)

32

u/smokingPimphat Mar 23 '20

Hello worlds are pretty good at showing a large enough chunk of a language so you can understand what you are getting into.

C++

//
#include <iostream>
 int main() {
     std::cout << "Hello World!";
 return 0;
 }

Python ( interactive shell )

print("Hello World")

In both these examples you see what you need to do in order to get output and you also see the basic syntax of the language ( ; at the end of statements for example )

in C++ you must include a header lib that handles the output then create the "main" function which handles the top level logic. You have to access the class function of std called cout to do the actual printing of "hello world" top the screen. You also see returns and the format of a function ( which you will have to use all the time ) Since C++ does not have an interactive shell like python you can infer that all your programs must follow this basic structure.

Hello worlds are also helpful to get new programmers excited about making stuff quickly as opposed to jumping into the complex abilities of a language for weeks before getting tangible results.

if you are coming from complied languages like C++ it can be quite obtuse to see simple python one liners doing the work of 5 lines of c++ but if you are new to programming it can be exciting to think you can get stuff on the screen in one line

21

u/Revanthmk23200 Mar 23 '20

The same can be shown with print("Hi"). Why specifically "Hello World" is what OP is trying to ask

8

u/smokingPimphat Mar 23 '20

Hi is boring

hello world is cool

lul

Others here basically answered that part, ( its a programmer meme ) but i figured a more lengthy explanation would be helpful

1

u/nog642 Mar 23 '20

I honestly don't think a hello world program gives you much of a good idea what a language is like at all. It just shows you the required boilerplate for a program, and how to print to the console. Besides that, it doesn't show you control structures or function calls or data types besides a string or classes or any other feature that might make a language distinct.

4

u/pauklzorz Mar 23 '20

The reason it's such a big deal is just that if you've gotten so far that you're getting the output you were expecting, it means all the other stuff, outside of your coding, is working properly. Like, your environment is correctly configured etc.

3

u/smokingPimphat Mar 24 '20

while true the Hello world gives you enough of the language to at least start messing around.

As for printing to the console, everybody starts at the console because its the simplest place to start. Imagine trying to teach hello world in python but you are printing to a window using tkinter or doing it in C++ doing bitshifting and pointer math.Sure you would learn a lot about the language but after all of that all you would have managed to do is print "Hello World" to the screen in the most complicated way imaginable.

14

u/Quixotic_Illusion Mar 23 '20

Meme. If you get into other languages like HTML, be prepared to also see, “lorem ipsum dolor...” as placeholder text.

3

u/Cuco1981 Mar 23 '20

As well as "The quick brown fox jumps over the lazy dog."

8

u/[deleted] Mar 23 '20

Those two come from typography.

4

u/[deleted] Mar 23 '20

Well it does has it's origins in this book: The C Programming Language First Edition by Dennis Ritchie, Brian Kernighan. That's just one site where you can find a free copy of it. It's pretty much everywhere on the web. It does make sense to use this sentence. When we start something from scratch and completely new and suddenly it starts working with minimum functionality, it kind of becomes our creation. Not just that, but it becomes also our own very special creation. That's also in my view why we say "Hello World" and not something else. We create something new, and we bring it to the world! It then says "Hello World!". At least that's my feeling on it.

4

u/santropedro Mar 23 '20

Because if you see a "hello world" you know exactly the program is for printing a message and nothing else less or more. It's a standard, a convention that helps learning faster.

6

u/tangerinelion (C++ Software Eng.) Mar 23 '20

Because a program is a new "life" that you've just made. They should introduce themselves, it's only polite.

6

u/Kwintty7 Mar 23 '20

To be welcomed into the world of programming, you must first introduce yourself. Skipping the ritual of "Hello World", through the medium of your new language, is incredibly rude and angers the gods of programming.

7

u/toastedstapler import itertools Mar 23 '20

it's pretty much the simplest program you can write to ensure that the thing actually runs

the actual text doesn't matter, it's just convention like i for looping, foo, baz and bar for random names etc

2

u/shamisha_market Mar 23 '20

Do foo baz and bar have actual meanings?

2

u/mkdz Mar 23 '20

Foo and bar come from FUBAR: https://en.wikipedia.org/wiki/Foobar

2

u/PM_me_ur_data_ Mar 23 '20

Not anymore. Foo and bar originally came from FUBAR (pronounced foo - bar) and it was kind of a self-deprecating joke about the code. Now, they're just random names that get used separate from that context.

1

u/notarobot1020 Mar 23 '20

It’s about getting a feedback, to prove that it’s actually there and working.

2

u/_w00k_ Mar 23 '20

I know everyone is giving technical answers but when Tiger Woods turned pro he said "hello, world" at the press conference.

2

u/Michalusmichalus Mar 23 '20

It's so that movie can make sense /s

2

u/Ikuyas Mar 23 '20

historical

2

u/shiftybyte Mar 23 '20

it can be print("Hi")

Because then you'd be asking why its "Hi" and not something else.

2

u/draganov11 Mar 23 '20

People used to say hello world with their first program because when you share it with people you dont know the all people personally and you say just hello to the whole world that will use your great program.

2

u/zqpmx Mar 24 '20

Tradition! Tradition! ...

Tradition!

3

u/flyingfox12 Mar 23 '20

Because the program you just wrote has "come alive" and entered this world. An appropriate thing to say is hello to the new world the program is now in.

2

u/saulsa_ Mar 23 '20

I use “Hello Sailor!”

2

u/jijijijim Mar 23 '20

My FORTRAN book did not have hello world.

1

u/taostudent2019 Mar 23 '20

Forgive me, I forget the details.

The brain allocates something like a 100 more spaces than it would to something like a chair.

So you use 'Hello World' to trick your brain into treating it like a person and being able to identify with the computer.

Qualifications: I have two engineering degrees and an educators certificate. Spent 4 years teaching.

1

u/notarobot1020 Mar 23 '20

Just a convention. The key thing is that printing gives you an immediate feedback to help with any debugging. It proves the program works. It’s the simplest debugging / feedback tool available. No point learning anything more complex until you have some method to measure it even works.

1

u/MirrorLake Mar 23 '20

It's quite a useful idea.

If you want to learn a new language (quickly), look up "[new language] hello world" and you'll be ready to start testing out that language. Pair it with a tutorial for how to install it, and you're ready to go.

https://rosettacode.org/wiki/Hello_world/Text

1

u/skellious Mar 23 '20

Hello, World! Is really useful as it demonstrates the minimum work needed to get a language to give output, which is often the starting point for useful programming.

1

u/xiongchiamiov xiongchiamiov Mar 23 '20

They definitely don't. Learn You a Haskell for Greater Good doesn't cover hello world until chapter five, because in a functional language you have to explain monads before you can modify something (like a console text stream).

1

u/crashomon Mar 23 '20

It’s the equivalent of “see Jane run”

1

u/[deleted] Mar 23 '20

A good question. "Hello world" Where does this traditional start program come from? What is the purpose behind it?

Article:

https://stackoverflow.blog/2020/03/05/a-modern-hello-world-program-needs-more-than-just-code/?utm_source=twitter&utm_medium=social&utm_campaign=so-blog

1

u/[deleted] Mar 23 '20

Hmm, the word meme has only been around for a few years. I'm struggling with what word did we use before "meme" was invented.

1

u/[deleted] Mar 23 '20

It's a programmer meme for sure, but it's very very old. It's from a time before memes were called as such.

1

u/11pascal Mar 23 '20

Dennis Ritchie. Creator of C and Unix. Worked for Bell labs. Ma Bell gave it away

1

u/blabbities Redux FTW Mar 23 '20 edited Mar 24 '20

Because they try to give you confidence that programming will be easy before they snatch it away and shuttering your whole existence 😆

1

u/johnne86 Mar 23 '20

I'm been fine with it while learning. Makes sense to have some unifed way of teaching the initial basics regardless of programming language.

What really confused me was Foo & Bar. Had no idea what they meant until I googled it. I initially thought it was some built in keyword or function to every language. I really don't like seeing them.

1

u/Kamelnotllama github.com/chadbailey Mar 23 '20

i'm a software engineer and have written numerous "hello, world" programs as proof of concepts while learning things. rather than using the typical "hello, world" phrase though, i tend to substitute with "hi mom". my mom passed away in 2010 so it is how i keep her in my memories and remember to say hi every now and then :)

1

u/[deleted] Mar 24 '20

Hello world how you learn to crawl for the first time.

1

u/Alex_Jinn Mar 24 '20

Have you heard the story of where "debugging" and "bugs" came from?

1

u/ExtraSpontaneousG Mar 24 '20

As has already been stated, it's simply convention. It's not just Hello World, either, I've noticed in multiple courses or tutorials will have you make very similar programs in their respective languages. Towers/staircases, caesar ciphers, 'bank software' and so forth.

1

u/rr381 Mar 24 '20

Strange. My first programs in a new (to me) language always print "Greetings Professor Falken."

1

u/Majestic-Wash3676 Mar 08 '25

In Apex class

public class HelloWorld{

public static void sayHello(){

System.debug('Hello World');

}}

1

u/thekringl Jun 03 '25

It's a initiation ritual.

1

u/[deleted] Mar 23 '20

I do Why

why.c

#include <stdio.h>

int main(int argc, char ** argv) {
   printf("\n\n\n   Why not?\n");
   return 0;
}

Yeah, it's basically hello world only it's a tiny bit more fun.

Noted the WHY command for HP 2100 DOSIII.

1

u/iWag Mar 23 '20

I use "Hello There"

2

u/BaalHammon Mar 23 '20

printf("General Kenobi !");

1

u/AdventurousAddition Mar 23 '20

Where the fuck's ur newline character, moight?

1

u/Kriss3d Mar 23 '20

Plus if you want it to be a tax more complex you could. Make it where you enter the hello part and the world! Part is a variable.

1

u/[deleted] Mar 23 '20 edited Mar 23 '20

It's a convention. Like how there's

function(args) {
    return stuff;
}

#Versus

function(args)
{
    return stuff;
}

There's a subtle difference in the braces. Some standards call for one over the other. "hello world" is a convention. When you use more complicated development environments such as virtualization containers and/or embedded chips, a simple "hello world" can require some effort on your part.

-2

u/Hagisman Mar 23 '20

Because everyone needs to be able to print text and declare variables.

0

u/[deleted] Mar 23 '20

[deleted]

26

u/BeakersBro Mar 23 '20

“My Computer Likes Me, When I Speak in Basic” was my intro to programming in 1975 - i still remember reading it in a Walgreen's parking lot while my Mom was shopping. It opened a whole new world to me, changed career from Biologist to Programmer, a let me build a lot of ridiculously complicated programs in 1976.

When your UI consists of teletypes, you can do a lot more with a lot fewer lines of code.

7

u/FoxClass Mar 23 '20

You went from biology to programming in (I assume) basic?! That must be one hell of a book. I like the name too it sounds like erotic fiction for programmers hahah

9

u/BeakersBro Mar 23 '20

It was a frickin gateway drug!

This was in the dark ages and access to computers was rare. High School got a teletype connected over modem to a HP2000F running basic. The physic's teacher had a stack of these little paper bound books - borrowed on, read it, started coding. Really crimped my social life junior year - got more balance senior year.

Was determined to be a microbiologist before that - afterwards, spent all my time either programming or playing computer games in independent study class or after school until they kicked me out.

There really isn't an equivalent easy way to start programming today - even something like Python is more complicated to learn, but is a lot more powerful.

4

u/FoxClass Mar 23 '20

So true - you must be around my dad's age since he had a similar experience in the 70s learning programming. I suppose back in punch-card days it was a little easier to have more comprehensive programming knowledge.

I started learning Python last year with no real programming experience and it's been a rollercoaster. It sure is amazing what you can do now (especially compared to what I could do as a kid on my IBM PC junior 😅) and there is a (nearly overwhelming) amount of resources on just about anything you could think of.

3

u/BeakersBro Mar 25 '20

Am 62.

My progression in technology was weird. Started out on teletypes in Basic, got to go the National Science Foundation summer camp where got to play/use a PDP 11/45 GT40, which could play Lunar Lander with real graphics!

Also learned Fortran (we were doing some Biology/Ecology modeling) and PL/1, but on terminals.

Went to college for a couple of years and worked part-time at SWPTC corp, which had an early 6800 based hobby microcomputer. Decided I wanted to go to a different college, dropped out and worked at Datapoint corp. for a couple of years, got to do a lot of interesting assembly programming projects and worked with early networks, remote storage, and laser links.

Went back to school and went to work for Atari afterwords. Hated Bay Area then, went to startup in Florida doing early fast 2d graphics. After that died, went corporate, but did a couple of more startups along the way.

Now I mainly do data analysis and system architecture and mainly us Python, cleaner code and fast enough.

1

u/FoxClass Mar 26 '20

I'm half your age and definitely have a lot of catching up to do. Only really wielding Python for data analysis but looking into GNU Octave for plotting and back to C++/Java for robotics. I think that's about as much as I can handle for now because there's so much to do with python alone (including AI and ML applications I can't wait to try)!