Skip to content

Hello World

ALGOL

BEGIN DISPLAY("HELLO WORLD!") END.
ASPECTJ
// HelloWorld.java
public class HelloWorld {
    public static void say(String message) {
        System.out.println(message);
    }

    public static void sayToPerson(String message, String name) {
        System.out.println(name + ", " + message);
    }
}

// MannersAspect.java
public aspect MannersAspect {
    pointcut callSayMessage() : call(public static void HelloWorld.say*(..));
    before() : callSayMessage() {
        System.out.println("Good day!");
    }
    after() : callSayMessage() {
        System.out.println("Thank you!");
    }
}

APPLESCRIPT

say "Hello, world!"

ASSEMBLY LANGUAGE

    global  _main
    extern  _printf

    section .text
_main:
    push    message
    call    _printf
    add     esp, 4
    ret
message:
    db  'Hello, World', 10, 0

BASH (UNIX SHELL)

#!/bin/bash
STR="Hello World!"
echo $STR

BASIC

10 PRINT "Hello, World!"
20 END

C

#include <stdio.h>

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

C++

#include <iostream>

int main()
{
    std::cout << "Hello, world!\n";
    return 0;
}

C#

using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Hello, world!");
    }
}

CAML (OCAML)

print_endline "Hello, world!";;

CLOJURE (CLOJURESCRIPT)

(println "Hello world!")

COBOL

       IDENTIFICATION DIVISION.
       PROGRAM-ID. hello-world.
       PROCEDURE DIVISION.
           DISPLAY "Hello, world!"
           .
COFFEESCRIPT
console.log "Hello, World!"

DART

main() {
  print('Hello World!');
}

DBASE (FOXPRO)

 ? "Hello World"

DELPHI (OBJECT PASCAL)

procedure TForm1.ShowAMessage;
begin
  ShowMessage('Hello World!');
end;

EIFFEL

class
    HELLO_WORLD
create
    make
feature
    make
        do
            print ("Hello, world!%N")
        end
end

ERLANG

 -module(hello).
 -export([hello_world/0]).

 hello_world() -> io:fwrite("hello, world\n").

ELIXIR

IO.puts "Hello World!"

F#

open System
Console.WriteLine("Hello World!")

FORTRAN

program helloworld
     print *, "Hello world!"
end program helloworld

GO

package main

import "fmt"

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

GROOVY (RUBY)

println "Hello World"

HASKELL

module Main where

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

IBM RPG

dcl-s wait char(1);

dsply ( 'Hello World!') ' ' wait;

*inlr = *on;

JAVA

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Prints the string to the console.
    }
}

JAVASCRIPT (ECMASCRIPT)

console.log("Hello World!");

LISP

(print "Hello world")

LOGO

TO HELLO
        PRINT [Hello world]
        END

LUA

print("Hello World!")

MACHINE CODE

b8    21 0a 00 00   #moving "!\n" into eax
a3    0c 10 00 06   #moving eax into first memory location
b8    6f 72 6c 64   #moving "orld" into eax
a3    08 10 00 06   #moving eax into next memory location
b8    6f 2c 20 57   #moving "o, W" into eax
a3    04 10 00 06   #moving eax into next memory location
b8    48 65 6c 6c   #moving "Hell" into eax
a3    00 10 00 06   #moving eax into next memory location
b9    00 10 00 06   #moving pointer to start of memory location into ecx
ba    10 00 00 00   #moving string size into edx
bb    01 00 00 00   #moving "stdout" number to ebx
b8    04 00 00 00   #moving "print out" syscall number to eax
cd    80            #calling the linux kernel to execute our print to stdout
b8    01 00 00 00   #moving "sys_exit" call number to eax
cd    80            #executing it via linux sys_call

MATHEMATICA (WOLFRAM LANGUAGE)

CloudDeploy["Hello, World"]

MATLAB

classdef hello
    methods
        function greet(this)
            disp('Hello, World')
        end
    end
end

ML

print "Hello world!\n";

NODE.JS

console.log("Hello World!");

OBJECTIVE-C

main()
{
  puts("Hello World!");
  return 0;
}

PASCAL

program HelloWorld(output);
begin
  Write('Hello, world!')
end.

PERL

print "Hello, World!\n";

PHP

<?php echo "Hello, World";

POWERSHELL

Write-Host "Hello, World!"

PYTHON

print("Hello World")

R

cat("Hello world\n")

RPG

dcl-s wait char(1);

dsply ( 'Hello World!') ' ' wait;

*inlr = *on;

RUBY

puts 'Hello World!'

RUST

fn main() {
    println!("Hello, world!");
}

SCALA

 object HelloWorld extends App {
   println("Hello, World!")
 }

SCHEME

(let ((hello0 (lambda() (display "Hello world") (newline))))
  (hello0))

SCRATCH

say Hello, World!

SELF

'Hello, World!' print.

SMALLTALK

Transcript show: 'Hello World!'.

SWIFT

println("Hello, world!")

TCL

puts "Hello World!"

TYPESCRIPT

console.log("Hello World!");

Credit to excelwithbusiness.com


Last update: June 25, 2021