Tuesday, May 06, 2025

The Hello World! Zoo

This was just a fun exercise for the remembrance of all the cool programming languages that have been developed and will be developed. Thank you for all these wonderful languages! I met some of the awesome programming languages designers and was always quite impressed.  It is one of the most difficult endeavors to create and evolve a language. I originally had focussed on compiler construction and AI in the late 1970s and 1980s during school and university. My first programming language has been TRS 80 Basic (obviously a sibling of Microsoft‘s MS Basic).

Note: I know there are websites where similar examples are listed, but I wanted to „feel“ the code myself.

Here is the famous, ubiquitous, unique, truly awesome  “Hello, World!” in a wide variety of programming languages. 

Consider it as kind of Programming Language Museum:


-- Ada

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


* SAP ABAP  

   REPORT ZHELLO_WORLD.  

       WRITE: / 'Hello, World!'.  


/* B */  

main() {  

    printf("hello, world");  

}  



# Befunge-93  

> v  

v ,,,,,"Hello"<  

>48*, v  

v,,,,,,"World!"<  

>25*,@  



/* C */

#include <stdio.h>

int main(void) {
    printf("Hello, World!\n");
    return 0;
}


// C++

#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}


// CUDA (C++ with NVIDIA extensions)  

#include <stdio.h>  
  
__global__ void helloKernel() {  
    printf("Hello, World from GPU!\n");  
}  
  
int main() {  
    // Launch one block of one thread  
    helloKernel<<<1, 1>>>();  
    // Wait for GPU to finish before exiting  
    cudaDeviceSynchronize();  
    return 0;  
}  


// D  

import std.stdio;  

void main()  
{  
    writeln("Hello, World!");  
}  


; Clojure  

(println "Hello, World!")  


# Crystal  

puts "Hello, World!"  


// Groovy  

    println "Hello, World!"  


// Java

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


 # Julia  

      function main()  
          println("Hello, World!")  
      end  

      main()  


(* OCaml *)  

let () =  
    print_endline "Hello, World!"  


# Python

print("Hello, World!")


// JavaScript (Node.js)

console.log("Hello, World!");


// TypeScript

console.log("Hello, World!");


# Ruby

puts "Hello, World!"


// Go

package main

import "fmt"

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


// Rust

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


// C#

using System;

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


// V  

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



// Haxe  

class Main {  
    static function main() {  
        trace("Hello, World!");  
    }  
}  


# GolfScript  

'Hello, world!'  


# Malbolge  

(=`#9]~67Y32Vx/4Rs+0No-&Jk"Fh}|Bcy? `=*2]Kw9ooG4UUSO/@-ejc(:'8dc  



# Ook!  

Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.  
Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.  
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook.  
Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.  
Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?  
Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook.  
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook.  
Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?  
Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!  
Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!  
Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.  



# Piet  

# (see 11×11 codel image that, when run in a Piet interpreter, outputs Hello, World!)  


// Swift

print("Hello, World!")


// Kotlin

fun main() {
    println("Hello, World!")
}


<?php

// PHP
echo "Hello, World!\n";


# Perl

print "Hello, World!\n";


#!/bin/bash

# Bash
echo "Hello, World!"


# PowerShell

Write-Host "Hello, World!"


-- Haskell

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


// Scala

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


-- Lua

print("Hello, World!")



# Underload  

    (Hello, world!)S  


# R

cat("Hello, World!\n")


// Zig  

const std = @import("std");  

pub fn main() void {  
    std.debug.print("Hello, World!\n", .{});  
}  


% MATLAB / Octave

disp('Hello, World!')


// Dart

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


# Elixir

IO.puts "Hello, World!"


% Erlang

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

start() ->
    io:fwrite("Hello, World!\n").


/* Ceylon */  

shared void run() {  
    print("Hello, World!\n");  
}  

;; Common Lisp

(format t "Hello, World!~%")


;; Scheme

(display "Hello, World!")
(newline)


(* Standard ML *)  

    print "Hello, World!\n";  


# Nim  

echo "Hello, World!"  


% Prolog

:- initialization(main).

main :-
    write('Hello, World!'), nl,
    halt.


// F#

printfn "Hello, World!"


' VB.NET

Module Module1
    Sub Main()
        Console.WriteLine("Hello, World!")
    End Sub
End Module


// Objective‑C

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSLog(@"Hello, World!");
    }
    return 0;
}


-- SQL

SELECT 'Hello, World!';


-- Eiffel  

class HELLO_WORLD  
create  
    make  
feature  
    make  
        do  
            io.put_string ("Hello, World!%N")  
        end  
end  


-- Elm  

import Html exposing (text)  

main =  
    text "Hello, World!"  


<!DOCTYPE html>

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


// Verilog  

module hello;  
    initial begin  
        $display("Hello, World!");  
        $finish;  
    end  
endmodule  


@ ARM Assembly (Linux syscall)  

    AREA    HelloWorld, CODE, READONLY  
    ENTRY  
start  
    MOV     R0, #1        @ file descriptor (stdout)  
    LDR     R1, =msg      @ address of string  
    MOV     R2, #14       @ length of string  
    MOV     R7, #4        @ syscall number (sys_write)  
    SWI     0             @ make syscall  

    MOV     R7, #1        @ syscall number (sys_exit)  
    SWI     0             @ make syscall  

msg  
    DCB "Hello, World!", 10  @ string plus newline  
    END  



# RISC-V Assembly (Linux syscall)  

    .section .rodata  
    .set    .L_STDOUT,     1  
    .set    .L_SYS_exit,   93  
    .set    .L_SYS_write,  64  
.L_message:  
        .ascii  "Hello, World!\n"  
    .set    .L_message_len, . - .L_message  

    .section .text  
    .globl  _start  
_start:  
    li      a7, .L_SYS_write    # syscall: write  
    li      a0, .L_STDOUT       # file descriptor: stdout  
    la      a1, .L_message      # address of message  
    li      a2, .L_message_len  # length of message  
    ecall  

    li      a7, .L_SYS_exit     # syscall: exit  
    li      a0, 0               # exit code 0  
    ecall  



# MIPS Assembly (Linux syscall)  

    .data  
msg:    .asciiz "Hello, World!\n"  

    .text  
    .globl main  
main:  
    li      $v0, 4        # syscall: print_string  
    la      $a0, msg      # address of msg  
    syscall  

    li      $v0, 10       # syscall: exit  
    syscall  



; x86 Assembly (NASM/Linux)

section .data
    msg db "Hello, World!",0xA

section .text
    global _start

_start:
    mov eax, 4        ; sys_write
    mov ebx, 1        ; stdout
    mov ecx, msg
    mov edx, 14       ; length
    int 0x80

    mov eax, 1        ; sys_exit
    xor ebx, ebx
    int 0x80


*> COBOL  

      IDENTIFICATION DIVISION.  

      PROGRAM‑ID. HELLO.  

      ENVIRONMENT DIVISION.  

      DATA DIVISION.  

      PROCEDURE DIVISION.  

          DISPLAY "Hello, World!".  

          STOP RUN.  



C FORTRAN  

      PROGRAM HELLO  

          PRINT *, 'Hello, World!'  

      END  



/* PL/1 */  

      HELLO: PROCEDURE OPTIONS(MAIN);  

          PUT LIST('Hello, World!');  

      END HELLO;  


\ FORTH  

      : hello  ( -- )  

          ." Hello, World!"  

          CR  

      ;  

      hello  


)COMMENT APL  

      ⎕←'Hello, World!'  



; Logo (UCBLogo)  

to helloworld  

    print [Hello, World!]  

end  



" Smalltalk (ANSI‑Smalltalk)  

Transcript show: 'Hello, World!'; cr.  



// Scratch (textual representation of blocks)  

// when green flag clicked  

say "Hello, World!" for 2 seconds  



comment ALGOL 60;  

      BEGIN  

          print("Hello, World!");  

      END  



// Pascal  

      program Hello;  

      begin  

          writeln('Hello, World!');  

      end.  



(* Modula-2 *)  

MODULE HelloWorld;  

IMPORT InOut;  

BEGIN  

    InOut.WriteString("Hello, World!");  

    InOut.WriteLn;  

END HelloWorld.  



(* Oberon *)  

MODULE HelloWorld;  

IMPORT Out;  

BEGIN  

    Out.String("Hello, World!");  

    Out.Ln;  

END HelloWorld.  



REM MS BASIC  

10 PRINT "Hello, World!"  

20 END  



REM MS‑DOS Batch  

@ECHO OFF  

ECHO Hello, World!  

PAUSE  



# Brainfuck  

>++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.  
>>++++++[<+++++++>-]<++.------------.>++++++[<+++++++++>-]<+.<.  


; Turing Machine (Hello, World!)  

; Alphabet: { _ (blank), H, e, l, o, ,,  (space), W, r, d, ! }  

; States: q0…q12, q_accept (halt)  

; Format of each transition:  

;   current_state  read_symbol  →  write_symbol  move_direction  next_state  


q0    _  →  H  R  q1  

q1    _  →  e  R  q2  

q2    _  →  l  R  q3  

q3    _  →  l  R  q4  

q4    _  →  o  R  q5  

q5    _  →  ,  R  q6  

q6    _  →     R  q7    ; space  

q7    _  →  W  R  q8  

q8    _  →  o  R  q9  

q9    _  →  r  R  q10  

q10   _  →  l  R  q11  

q11   _  →  d  R  q12  

q12   _  →  !  R  q_accept  

; final transition to halt (no movement)  

q_accept  _  →  _  N  HALT  




; Markov algorithm  

; Rewrite rules to transform the start symbol “S” into “Hello, World!”  
; Initial string: S  
1. S  -> H A  
2. A  -> e B  
3. B  -> l C  
4. C  -> l D  
5. D  -> o E  
6. E  -> , F  
7. F  -> ␣ G     ; use “␣” to denote a space  
8. G  -> W H1  
9. H1 -> o I  
10. I  -> r J  
11. J  -> l K  
12. K  -> d L  
13. L  -> ! M  
14. M  ->     ; rule with empty RHS halts the algorithm  
; Explanation of application:
; – Start with “S”
; – Apply rule 1: “S” → “H A”
; – Apply rule 2 on “A”: “H A” → “H e B”
; – …and so on, until rule 14 removes the final marker “M”
; – Resulting string: “Hello, World!”  







No comments: