Hello World in 8 Programming Languages
Whenever learning a new programming language, I often start with a “hello world” program.
This teaches me a few things about the language:
- What the basic syntax looks like
- How to output text to the screen
- How complex a language might be to learn (i.e. C++ vs Python)
I thought it would be fun to share “hello world” programs in languages I have used over the years. Below are examples from 10 different programming languages. Enjoy!
C
C is a compiled programming language originally created by Dennis Richie in 1972 at Bell Labs. It is mainly used in embedded systems, operating systems, compilers, and network servers. Many modern-day programming languages have adopted C-like syntax.
#include <stdio.h>
int main() {
printf("Hello, World!\\n");
return 0;
}
Python
Developed by Guido von Rossum and released in 1991, Python is a general-purpose, interpreted language. Python’s design philosophy is to be easy to read and fun to use. As a result, many developers have gravitated towards it and created robust libraries for web scraping, machine learning, scientific computing, and GUIs - just to name a few. Python’s simple syntax allows for one of the shortest “hello world” programs.
print('Hello, World!')
JavaScript
JavaScript was created in 1995 by Brendan Eich for the Netscape Navigator, and is one of the core web technologies alongside HTML and CSS. It originated as a client-side programming language to add functionality to websites. Over time, JavaScript has spread its metaphorical wings to areas such as server-side and desktop programming applications.
console.log('Hello, World!')
Bash
Bash is a scripting and shell command language written in C by Brian Fox. Released in 1989, Bash’s goal was to be a free and open source shell that incorporated features from the Korn shell (ksh) and C shell (csh). It is used by system admins and software developers to easily automate tasks.
#!/bin/sh
echo "Hello, World!"
C#
C# (pronounced see sharp, like the musical note) was developed and designed by Andres Hejlsberg at Microsoft in 2000. C# was created to address flaws in other major programming languages like C++ and Java. The Unity game engine uses C# as its primary scripting language.
using System;
class MyProgram
{
public static void Main(string\[\] args)
{
Console.WriteLine("Hello, World!");
}
}
Go
Conceived in 2007, Go is a compiled language created by Robert Griesemer, Rob Pike, and Ken Thompson (what a group!) at Google. The language is designed for people working on large scale systems, such as Google’s massive infrastructure of multi-core data clusters.
package main
import "fmt"
func main() {
fmt.Printf("Hello, world!\\n")
}
OCaml
OCaml is a functional programming language developed in 1996 for solving mathematical proofs. Since then, it has been used in areas like systems programming, web development, and teaching.
print\_endline "Hello, World!";;
HTML
Ok, technically HTML is not a programming language - it’s a markup language - but oh well. HTML renders the content (text, images, links, etc) that is displayed on a website. It was initially released in 1993 by WHATWG and uses “tags” to structure a website’s content in a hierarchical structure. HTML can be viewed by pressing Ctrl+Shift+I or Ctrl+U.
<!DOCTYPE html>
<body>
<h1>Hello, World</h1>
</body>
</html>