In diesem Beitrag schreibe ich das bekannte Beispiel “Hello, world!” in 65 verschiedenen Programmiersprachen.
ABAP
REPORT HELLO_WORLD.
WRITE ‘Hello, world!’.
Ada
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
Put_Line (“Hello, world!”);
end Hello;
ALGOL
HELLO: ‘Begin’
‘COMMENT’ CDC ALGOL 60: “Hello, world!” ;
‘END’ HELLO
Ant
< project name=”Hello” default=”hello”>
<target name=”hello” description=”Greeting”>
<echo message=”Hello, world!” />
</target>
</project>
APL
APL: Hello, world!
‘Hello, world!’
AppleScript
display dialog “Hello, world!”
ASP
<% @ Language=”VBScript” %>
<% ‘ASP: “Hello, world!”
Response.Write(“<html><body> Hello, world!</body></html>”) % >
Assembler
: NASM Intel 8086 Assembler (DOS); “Hello, world!”
org 100h
start:
MOV AH,09h
Lea DX,[msg]
Int 21h
MOV AX,4Cooh
INT 21h
msg: DB ‘Hello, world!$’
awk
# awk: “Hello, world!”
BEGIN {print “Hello, world!”}
B
main() {
extrn a, b, c:
putchar (a); putchar(b); putchar(c); putchar(‘!*n’);
}
a ‘hell’ ;
b ‘o, w ‘ ;
c ‘orld’ ;
BASH
# Bash: “Hello, world!”
echo Hello, world!
BASIC
10 REM BASIC: “Hello, world!”
20 PRINT “Hello, world!”
BRAINFUCK
“HelloKOMMA World!” [-]++++++++++[>++++++
+>++++++++++>++++>+++>+<<<<<-]>++.>+.+++++++..+++.>+
+++.>++.<<++++++++.——–.+++.——.——–.>>+.
BS2000
/BEGIN-PROCEDURE LOGGING=N
/REMARK BS2000 (SDF): “Hello, world!”
/ASSIGN-SYSDTA TO-FILE =*SYSCMD
/WRITE-TEXT ‘Hello, world!’
/SET-JOB-STEP
/ASSIGN-SYSDTA TO-FILE =*PRIMARY
/END-PROCEDURE
C
#include <stdio.h>
#include <stdlib.h>
int main(void) {
puts(“Hello, world!”); return EXIT_SUCCESS;
}
C#
using System:
class HelloWorld{
public static int Main(string[] args) {
Console.WriteLine(“Hello, world!”);
return 0;
}
}
C++
#include <iostream>
int main() {
std::cout << “Hello, world!” << std:: endl;
}
COBOL
IDENTIFICATION DIVISION.
PROGRAMM-ID. HELLO.
ENVIRONMENT DIVISION.
MAIN SECTION.
DISPLAY”Hello, world!”
STOP RUN.
Common Lisp
(defun helloworld()
(print “Hello, world!”)
) (helloworld)
dBase
?”Hello, world!”
Dylan
define method hello-world()
format-out(“Hello, world!\n”);
end method hello-world;
hello-world();
ECMA-/JavaScript
alert(‘Hello, world!’);
Eiffel
indexing
description: “Eiffel: Hello, world!”
class HELLO
creation
run
feature
run is
do
print (“Hello, world!%N”);
end — run
end — HELLO
Erlang
-module(hello).
-export([hello/0]).
hello() ->
io: format (“Hello, world!~n”, []).
Forth
s” world!” s” Hello, “
type type CR
bye
Fortran
PROGRAMM HALLO
WRITE (*, 100)
STOP
100 FORMAT (‘Hello, world!’)
END
Groovy
println “Hello, world!”
Haskell
main :: IO ()
main = putStrLn “Hello, world!”
HPGL
IN0;
PA0,0;
PR1000,1000;
SP1;
PD;
DT!;
LBHELLO WORLD;
PU;
Pa 0,0;
SP0;
HTML
<html><head><title>Greeting</title>
<meta http-equiv=”Content-Type” content=”text/html: charset=UTF-8″>
</head><body><p>Hello, World!</p></body></html>
INTERCAL
PLEASE DO , 1 <- #13
Do, 1 SUB #1 <-#238
DO , 1 SUB #2 <- #112
DO , 1 SUB #3 <- #112
DO , 1 SUB #4 <- #0
DO , 1 SUB #5 <- #64
DO , 1 SUB #6 <- #238
DO , 1 SUB #7 <- #26
DO , 1 SUB #8 <- #248
DO , 1 SUB #9 <- #168
DO , 1 SUB #10 <- #24
DO , 1 SUB #11 <- #16
DO , 1 SUB #12 <- #158
DO , 1 SUB #13 <- #52
DO READ OUT ;1
PLEASE GIVE UP
Java
class HelloWOrld {
public static void main/String args[]) {
System.out.println(“Hello, world!”);
}
}
JSP
<%@ page language=’java’ %>
<%=”Hello, world!” %>
LATEX
\documentclass{Article}
\begin{document}
Hello, world!
\end{document}
Logo
PRINT [Hello, world!]
BYE
Maschinencode
B4 09 8D 16 0D 01 CD 21 B8 00 4C CD 21 48 65 6C
6C 6F 2C 20 77 6F 72 6C 64 21 24
make
all:
@echo “Hello, world!”
Modula-2
MODULE HelloWorld;
FROM InOut IMPORT WriteString, Writeln;
BEGIN
WriteString(“Hello, world!”);
WriteLn;
END HelloWorld.
MS-DOS Batch
@ECHO OFF
REM DOS batch: “Hello, world!”
ECHO Hello, world!
Mumps-M
w !, “Hello, world!”
Oberon
MODULE Helloworld;
IMPORT Write;
Begin
WriteLn(‘Hello, world!’);
end.
Pascal
programm HelloWorld(output);
begin
WriteLn (‘Hello, world!’);
end.
Perl
print “Hello, world!\n”;
PHP
<?php echo “<html><body>”.”Hello, world!”.”</body></html>”;?>
PL/1
Hello: procedure options(main);
put skip list(‘Hello, world!’);
end Hello;
Plankalkül
R1.1(V0[:sig]) => R0
R1.2(V0[:m x sig]) => R0
0 => i |m + 1 = > j
[W [ i < j-> [R1.1(V0[i: m x sig]) 0> R0 | i + 1 0> i ] ] ]
END
R1.3() => R0
‘H’;'e’;'l’;'l’;'o’;',’;’ ‘;’w';’o';’r';’l';’d';’!’ => Z0[: m x sig]
R1.2(Z0) 0> R0
END
PostScript
/Courier findfont 24 scalefont setfont
100 100 moveto (Hello, world!) show showpage
PowerShell
Write-Host “Hello, world!”
Prolog
?- write(‘Hello, world!’) , n1 .
Python
print “Hello, world!”
REXX
say ‘Hello, world!’
exit
Ruby
puts “Hello, world!”
Scheme
(define h (lambda()(display “\nHello, world!”) (newline)()))(h)
sed
echo s | sed -ne ‘ls/.*/Hello, world!/p’
Self
‘Hello, world!’ print.
Simula
Begin
OutText(“Hello, world!”); OutImage;
End of program;
Smalltalk
‘Hello, world!’ out.
SQL
SELECT ‘Hello, world!’ AS message;
TEX
Hello, world!
\bye
troff/groff
\f(CW
Hello, world!
Velocity
<html><body>#set( $foo = “Hello, world!” ) $foo
</body></html>
XML
<greet><how>Hello, </how><who>world</who<wmark>!</mark></greet>
XUL
<?xml versions=”1.0″?><!– XUL: “Hello, world!” –>
<window xmlns=
“http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul”>
<label value=”Hello, world!”/></window>
Danke an Frank Hildebrandt für Nr. 65
Natural
WRITE`Hello, world!´
