top of page
Writer's pictureD A Rosi Arsida Wardani

Hello, World!

The Introduction Words to Programming

image : Program "Hello, World!" in C++


"Hello, World!" is the first program one usually writes when learning a new programming language. Almost every time someone is just starting to code, or even when an experienced programmer decides to learn a new language, the first thing they do is get the computer to say “Hello, World!”.


However, have you ever wondered, why "Hello, World!"? What makes it so popular? Who is the author?


In this blog, we will discusses the history of "Hello, World!" and how we write it in C++, Python, PHP, and Java programming languages.


History

First mentioned in Brian Kernighan's "A Tutorial Introduction to the Language B" published in 1972. In this book, the first known version of the program was used to illustrate external variables. Because the previous example in the tutorial printed “hi!” on the terminal, the phrase “Hello, World!” required more character constants for expression and was the next step in the learning process.


The program appears in section 7 — External Variables in the following form to demonstrate the piecing together of several char variables :


main(){
    extrn a,b,c;
    putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';

It became widely known through Kernighan & Ritchie's 1978 book titled "The C Programming Language”. First appears in section 1.1 — Getting Started :


main(){
    printf ("hello, world\n");
}

The main () function determines where the program should run. The function body consists of a single statement, a call to the printf function, which stands for "print formatted". This function will cause the program to output whatever is passed as a parameter, in this case the string hello, world, followed by a newline character.


Since then, “Hello, World!” has been implemented in almost all programming languages on the planet.


Fun Fact!

Before Kernigham’s books on B and C, there was no first standard program. Even until 1972, it was not widely used. The popular BASIC tutorial, "My Computer Likes Me, When I Speak the Basic Language", starts with a simple program that writes a line of text. However, this message is "MY PEOPLE UNDERSTAND ME", far from the two-word saying that programmers use today.


What Makes It So Popular?

Traditionally, “Hello, World!” is the first program that developers used to test the system. For programmers, seeing two words on the screen means their code can compile, load, run, and they can see the output.


But what made it so wildly popular? This is partly just practical: It's a quick way to get a peek at what coding languages look like and whether you'll like the syntax. But, the real reason is its sheer metaphoric jolt. It taps directly into the thrills of programming, which are deeply Promethean.



“Hello, World!” In C++, Phyton, PHP, Java


C++

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

or we can write :

#include <iostream>
using namespace std;
int main(){
  cout<<“Hello, World!”;
  return 0;
}

Phyton

print("Hello, World!")

PHP

<?php
  echo 'Hello World!';
?>


Java

class HelloWorld {
  static public void main(string args[]) {
    system.out.println("Hello World!");
  }
}

Reference :

Hansha, Ozaner. (2017, July 10). On the Origin of "Hello, World!". Retrieved from On the Origin of “Hello, World!”. How one of programming’s oldest… | by Ozaner Hansha | Medium

Thussong. (2015, July 17). The History of Hello World . SOFTWAREGUILD. Retrieved from The History of Hello World (thesoftwareguild.com)

Thompson, Clive. (2019, October 16). Hello, "Hello, World". SLATE . Retrieved from Why the first code a programmer writes is “Hello, World.” (slate.com)

Trikha, Ritika. (2015, April 21). The History of 'Hello, World'. HackerRank. Retrieved from The History of 'Hello, World' (hackerrank.com)

Recent Posts

See All

Comments


Post: Blog2_Post
bottom of page