Why ‘Hello World!’?

The very first program we all have written is printing ‘Hello, World!’ on the console. No matter which technology or language we are working on, we often use this to check if the program is working or not. Also in all the schools, colleges, the first program for any programming language is ‘Hello, World!’. Have you ever thought about why it is so? Why we use only this string all the time? Even today, I also write this string to check whether the system is running or not.

But where this started? When it was originated? Who used this revolutionary term first in the code?

Let’s try to find out the answers to these questions.

 

The Beginning

Although there is no such start date mentioned anywhere it is said that this phrase was used first in Brian Kernigham’s book, ‘A Tutorial Introduction to Language B’ in 1973. and it was written as ‘hello, world!’, all small caps with a coma in between and an exclamation mark in the end. By then Hello World was used to illustrate some functions of the program (Not to test whether the system is running). They used this string because it is long, includes space and special characters in it.

Later, it was used in Bell Laboratories memo in 1974 again to test some functionalities and in the book ‘The C Programming Language’ in 1978. This book popular the text Hello World. In this book, the hello world is written as ‘hello, world’, which was again not used to test the program, but to perform some functionalities.

After that, all the textbooks adopt these words to run the first program and test it.

 

Hello World in Different Languages

1.) Java
class HelloWorld {
    public static void main (String args[]) { 
        System.out.println("Hello, World!");
    }
}
2.) Python
print('Hello, world!')
3.) C++
#include <iostream>
int main() {
    std::cout << "Hello World!";
    return 0;
}
4.) Ruby
puts "Hello, World!"
5.) Javascript
alert("Hello, World!")
6.) C#
namespace HelloWorld
{
    class Hello {
        static void Main(string[] args)
        {
            System.Console.WriteLine("Hello World!");
        }
    }
}
7.) PHP
<?php
    echo "Hello World!";
?>
8.) GO
package main
import "fmt"
func main() {
    fmt.Println("hello world")
}

Conclusion

We know well that whatever language we choose, the first program will always be ‘hello world!’. What else can be better than this little complete sentence? Today most of us use this phrase to run the program or to test whether it is running or not.
Let’s say there is a scenario in which you have to choose one phrase like this, what would you choose?

Let me know in the comments below.

 

This Post Has 2 Comments

  1. Aman Agarwal

    Hey Akshay, your blog is informative and easy to read… Thanks for sharing knowledge!!

  2. Ayush Aggarwal

    Hello Akshay, it was a nice read, and I love how you came out with the basics in an informative yet brief approach. Looking forward to more of such articles from your side. 🙂

Comments are closed.