Publication: CATS Newsletter
Pub Details: CATS v12 n7-8 (Volume 12, Issue 7-8)
Date: November - December 1994
Pages: 5-6
In a number of recent postings to alt.folklore.computers, the answer to the question “What’s the shortest ‘Hello, World’ program for a specific computer language? For those that don’t know, ‘Hello, World’ is the first program used in K&R’s book on C and is synonomus with the simplest program to write as a beginner. The whole scope of the program is to print the string ‘Hello, World’.
Here is a summary of the results of the postings:
BASIC:
10 PRINT "Hello, World"
FORTRAN IV:
WRITE(6,100)
100 FORMAT(13H Hello World!)
ST OP
E N
*D
COBOL:
IDENTIFICATION DIVISION.
PROGRAM-ID. WORLD.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
BOO.
DISPLAY "Hello, world!" UPON
CONSOLE.
STOP RUN.
ADA:
With STANDARD_IO;
Use STANDARD_IO;
Procedure HELLO_WORLD is
begin
Put("Hello world!");
end HELLO_WORLD;
C:
#include <stdio.h>
main()
{
printf('Hello, World!");
}
perl:
#/usr/local/bin/perl
print "Hello, World!\n";
Postscript:
100 100 moveto /Times-Roman findfont
24 scalefont
(Hello, World!) show showpage
FORTH:
."Hello, World!"
Lisp:
(print "Hello, World!")
Smalltalk:
'Hello, World!' PrintN1 !
PILOT:
10 T:Hello, World!
REXX:
SAY "Hello, World!"
Modula-2:
MODULE HelloWorld;
IMPORT InOut;
BEGIN
WriteString ("Hello, World!");
WriteLn;
END HelloWorld.
Here is an interesting one in C. I have not checked this one to see if it runs under C68.
#define _ (int) putchar
main() { int c = 0110
;_(c);c+=29;_(c);c+=7
;_(c);_(c);c+=3;_(c)
;c=0x20;_(c);c=0127
;_(c);c+=24;_(c);
c+=0x3;_(c);c-=
6;_(c);c-=010;
_(c);c=0x21;
_(c);_(10)
;c+=66;}
Nokolisp: (which had only symbols – no character strings)
(compress (append (explode 'Hello) (cons
32 (explode 'world.))))