This repository contains code that outputs "Hello World" to stdout in various programming languages. "Hello World" programs are typically the first code most new comers use to interface with a programming language. Per this Stackoverflow answer such programs were first used by Brian Kernighan and Martin Richards at Bell Labs during 1970s and tradition has since been honored by many new programming language books, tutorials and courses.

Ada

with Ada.Text_IO;
use Ada.Text_IO;
procedure AdaHelloWorld is
begin
     Put_Line ("Hello World");
end AdaHelloWorld;

Bash

#!/usr/bin/bash

echo "Hello World";

C#

using System;

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

C++

#include <iostream>

int main(int argc, char** argv) {
  std::cout << "Hello World" << std::endl;
  return 0;
}

C

#include <stdio.h>

int main(int argc, char** argv) {
  printf("Hello World\n");
  return 0;
}

Css

body::after {
  content: "Hello World";
}

Elixir

IO.puts "Hello World"

Erlang

% Module deliberately misspelt to avoid conflict with system module with same
-module(erlaang).
-export([hello_world/0]).

hello_world() -> io:fwrite("Hello World\n").

F#

printfn "Hello World\n"

Golang

package main;

import "fmt"

func main() {
  fmt.Println("Hello World")
}

Haskell

main :: IO()
main = putStrLn "Hello World"

Html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <h1>Hello World</h1>
</body>
</html>

Java

class Java {

  public static void main(String[] args) {
    System.out.println("Hello World");
  }
}

Javascript

console.log("Hello World");

Lua

print("Hello World")

Ocaml

open Printf;;
Printf.printf "Hello World\n";;

Perl

#!/usr/bin/perl

print "Hello World\n"

Powershell

Write-Host "Hello, World"

Processing

size(128, 128);
background(0);
textAlign(CENTER, CENTER);
fill(255);
text("Hello World", width / 2, height / 2);

Prolog

:- initialization(main).
main :- writef("%s\n", ["Hello World"]).

Python

#!/usr/bin/env python

if __name__ == '__main__':
    print("Hello World")

R

print("Hello World")

Ruby

#!/usr/bin/ruby

print "Hello World\n"

Rust

fn main() {
  println!("Hello World");
}

Scm_Chicken

(print "Hello World");

Built With

Share this project:

Updates