Say Hello World in 7 Languages

31 Jul, 2019


Photo by Vladislav Klapin

Hello World. It’s the first piece of code written while learning a new programming language. This simple practice has a significant purpose, to ensure the setup works as expected. Brian Kernighan started this tradition back in 1972. He debuted the first version of Hello World in a book titled A Tutorial Introduction to the Language B

Original Hello World code from the book for reference

main( ) {
  extern a, b, c;
  putchar(a); putchar(b); putchar(c); putchar('!*n');

a 'hell';
b 'o, w';
c 'orld';

A character constant in B is limited to 4 ASCII characters & hence the need of 3 variables for the message

Let’s write the traditional Hello World program in 7 different languages


Microsoft’s primary language for .NET & it’s the most popular one out of all .NET languages. C# has typical C style syntax with a rich set of features & the language is battle tested against time. It started as a proprietary language but later got open-sourced

class Program {
  static void Main() {
    System.Console.WriteLine("Hello World!");


An open source & functional-first programming language, interoperable with all other languages of .NET. F# offers a functional alternative to C# developers while staying within .NET ecosystem

printfn "Hello World!"


An open source language created at Google to be idomatic & fast. C was the inspiration behind Go & so it follows a similar syntax. It offers many improvements over C & comes with in-built concurrency model

package main

func main() {
  println("Hello, World")


An open source language designed to improve code readability with use of white space. Python is simple to learn & has a large community supporting the ecosystem. It’s popular among hackers & comes installed on most Linux distributions. Python 2 & 3 have slight syntactical differences between them

# python 2
print "Hello World"

# python 3
print("Hello World")


It’s the most popular language in this list. JavaScript was the result of browser wars, created in 10 days by a single NetScape employee. It used to run inside the browser once, but got exploded along the way & now spans across Desktop, Mobile, IOT & what not

console.log("Hello World")


Microsoft’s task automation & configuration management framework providing full access to Windows. PowerShell is like a scripting language that’s built with .NET using special classes. It was proprietary & Windows only but with PowerShell Core it became open source & cross platform

"Hello World"

Shell Script

A simple yet powerful scripting language to interact with & automate the operating system. Shell is a special user interface that accepts input from the user & executes it with the kernel. It’s a command language interpreter with the power to control entire Linux OS

echo "Hello World"