In 1982, I was introduced to my first computer, an Atari 400, by a teacher,
Mr. Ferguson, in Butler, Utah. This began a fascination with computers that led
to reading gratis magazines from Radio Shack (no, I never used a TRS-80), and
later Byte magazine. A neighbor showed me how to use his Atari 800, including
connecting to a neighbor's Software Exchange BBS using a 300 baud modem. I
began programming in 1984 on an Atari 800 XL with an upgraded 128K of RAM. I
wrote school papers in Atari Writer, learned my first spreadsheet (SynCalc),
and wrote my first programs in Atari Basic learning from Kids & the
Atari[CT83], by Edward H.
Carlson. The first of 33 lessons is to print hi
, an output program
typified by Kernighan and Ritchie's beachhead hello, world
(see
Exercise 1-1 of The C Programming Language
[KR78], and Exercise 1-2 of
Software Tools in Pascal
[KP81] as given by the
echo
manual, page 45).
After the Atari I owned an original IBM Portable PC 5155 with an upgraded PC
DOS 3.3. I used WordPerfect 4.2 on that system, and have learned some of the
Modula-2 systems that ran on it. My next system was an NEC Ready 9022 with the
Intel Penitum. It came with Windows 95, but I hated it, and switched to Windows
NT, with an MS-DOS 6.22 dual boot. I then got a BSDi custom built system with
FreeBSD, which I later replaced with OpenBSD. I replaced the NT install with
Slackware. I've worked with many different kinds of systems since, (e.g. Xenix,
OpenServer, HP-UX 11i, Mac System 7, Red Hat Linux, SuSE). Here are hello,
world
programs in languages (non-exhaustive) I've learned over the years
on many different platforms.
10 REM ATARI BASIC
20 PRINT "HELLO, WORLD"
comment Algol-60 Modified Report and ISO 1538: 1984.
begin
comment The standard does not allow a newline here, (NASE or Marst has \n).
outstring(1,'hello, world')
end.
C Fortran 66
WRITE (6,7)
7 FORMAT(13H HELLO, WORLD)
STOP
END
program hello
! Fortran 90 and above.
print *, "hello, world"
end program hello
program hello(output);
(* Pascal *)
begin writeln('hello, world')
end.
#!/bin/sh
# Unix Bourne and Posix shell
echo hello, world
# Perl 5.
print "hello, world";
<?php
// PHP
echo "hello, world\n";
?>
# Python 3.
print("hello, world")
Here's my best guess for Modula(-1). I believe the PDP-11 that Modula was designed on had a teletype for output that would need a string function built, similar to Pascal. The report doesn't specify a built-in, other than a device module that would provide a simple character output write to the teletype, but I could have misread the report. This was too fun to not try assuming a message procedure like in CDC Pascal:
module hello;
(* Using a Pascal-like message function,
presumed to be exported from the program module. *)
use message;
begin message("hello world!")
end hello
MODULE hello;
(* Modula-2 PIM/Medos-2/RT-11 standard library. *)
FROM InOut IMPORT WriteString, WriteLn;
BEGIN WriteString("hello world!"); WriteLn
END hello.
MODULE hello;
(* Modula-2 ISO/IEC 10514-1:1996 standard library. *)
FROM STextIO IMPORT WriteString, WriteLn;
BEGIN
WriteString("hello world!");
WriteLn
END hello.
(* Oberon 1987/88 definition module. *) DEFINITION hello; END hello.
(* Oberon 1987 implementation module *) IMPLEMENTATION hello; (* DEE 2018-09-08/2019-07-17 *) IMPORT Texts, Oberon; VAR W: Texts.Writer; PROCEDURE world; BEGIN Texts.WriteString(W, "hello, world"); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END world; BEGIN Texts.OpenWriter(W) END hello.
This relies on the above
DEFINITION
:
(* Oberon 1988 module *)
MODULE hello; (*DEE 2019-07-17*)
IMPORT Texts, Oberon;
VAR W: Texts.Writer;
PROCEDURE world;
BEGIN Texts.WriteString(W, "hello, world");
Texts.WriteLn(W);
Texts.Append(Oberon.Log, W.buf)
END world;
BEGIN Texts.OpenWriter(W)
END hello.
(* Using Reiser's In/Out in Oberon since 1989. *)
MODULE hello; IMPORT Out; (* DEE 2018-09-21 *)
BEGIN Out.Open;
Out.String("hello, world"); Out.Ln
END hello.
(* For Oberon 1989 and Oberon 2013. *)
MODULE hello; (* DEE 2016-08-15 *)
IMPORT Texts, Oberon;
VAR W: Texts.Writer;
PROCEDURE world*;
BEGIN Texts.WriteString(W, "hello, world");
Texts.WriteLn(W);
Texts.Append(Oberon.Log, W.buf)
END world;
BEGIN Texts.OpenWriter(W)
END hello.
©2017-2022 David Egan Evans.