music
OSdata.com: programming text book 

OSdata.com

Hello World

summary

    The educational goal of this subchapter is to give the student a general idea of what a simple computer program looks like in their chosen language. The professor may present only the example from the programming language being taught or may show many examples to give a feel for some of the similarities and differences between common programming languages.

    The classic example for any programming language is “Hello World” (a simple program that writes the text “Hello World”). These examples show how to write this simple program in different programming languages.

free computer programming text book project

table of contents
If you like the idea of this project,
then please donate some money.
more information on donating

Google

Hello World

    The cliche first program is Hello World — a simple program that types the message “Hello World”. Even experienced programmers will often write a simple Hello World program when learning a new programming language or switching to a new development environment.

    Kernighan and Ritchie popularized the Hello World! program in their book C Programming Language.

    Every programming language has its own peculair rules for the form of a program. The Hello World program is a fine illustration of the basic rules of a programming language.

    All of the code below produces the same basic results: printing or typing the phrase “Hello World”. You may want to take a brief look at how different languages can have very different methods for achieving the same results.

Ada

with Ada.Text_IO;
use Ada.Text_IO;

procedure HelloWorld is
begin
   Ada.Text_IO.Put_Line("Hello World");
end HelloWorld;

    Ada was first released in 1983 (ADA 83), with major releases in 1995 (ADA 95) and 2005 (ADA 2005). Ada was created by the U.S. Department of Defense (DoD), originally intended for embedded systems and later intended for all military computing purposes.

    Ada is named for Augusta Ada King, the Countess of Lovelace, the first computer programmer in modern times.

ALGOL

BEGIN
   OUTSTRING(2, "Hello World");
END.

    ALGOL (ALGOrithmic Language) was first formalized in 1958 (ALGOL 58), with major releases in 1960 (ALGOL 60) and 1968 (ALGOL 68). ALGOL was originally intended for scientific computations.

    ALGOL is considered to be the first second generation computer language.

    ALGOL was a highly influential programming language. Most modern programming languages are descendants of ALGOL.

    ALGOL introduced such concepts as: block structure of code, scope of variables, BNF notation for defining syntax, dynamic arrays, reserved words, and user defined data types.

BASIC

10 PRINT "Hello World"

    BASIC (Beginner’s All-purpose Symbolic Instruction Code) was designed as a teaching language in 1963 by John George Kemeny and Thomas Eugene Kurtz of Dartmouth College.

C

#include <stdio.h>

main()
{
   printf("Hello World\n");
}

    C was developed in 1972 by Dennis Ritchie of Bell Telephone Laboratories for use in systems programming for UNIX.

C++

#include <iostream.h>

int main(int argc, char *argv[])
{
   cout << "Hello World" << endl;
   return 0;
}

    C++ was developed in 1983 by Bjarne Stroustrup at Bell Telephone Laboratories to extend C for object oriented programming.

COBOL

IDENTIFICATION DIVISION.
PROGRAN-ID. HelloWorld.
AUTHOR. Milo.

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION.

DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
LINKAGE SECTION.

PROCEDURE DIVISION.
DISPLAY "Hello World".
STOP RUN.

    COBOL (COmmon Business Oriented Language) was created in 1959 by the Short Range Committee of the U.S. Department of Defense (DoD). Official ANSI standards included COBOL-68 (1968), COBOL-74 (1974), COBOL-85 (1985), and COBOL-2002 (2002). COBOL 97 (1997) introduced an object oriented version of COBOL.

Dylan

define method hello-world()
   format-out("Hello World\n");
end method hello-world;

hello-world();

    Dylan was created in the early 1990s by Apple Computer and others. Dylan was originally intended for use with the Apple Newton, but wasn’t finished in time.

Forth

: hello_world ." Hello World" ;

    Forth was created by Charles H. Moore in 1968. Forth was a reference to Moore’s claim that he had created a fourth generation programming language.

FORTRAN

      PROGRAM HELLO
      WRITE(UNIT=*, FMT=*) 'Hello World'
      END

    FORTRAN (FORmula TRANslation) was created in 1954 at International Business Machines (now IBM). FORTRAN is the oldest programming language still in common use.

HTML

<html>
<head>
<title>Hello World</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>

    HTML (HyperText Markup Language) was developed in 1989.

Java

import java.applet.*;
import java.awt.*;
Public class HelloWorld extends Applet
{
public void paint(Graphics g)
   {
      g.drawstring("Hello World".,10,10);
   }
}

    Java (a reference to coffee) was created by Sun Microsystems and released in 1995.

LISP

(print "Hello World".)

    LISP (LISt Processing) was created n 1958 by John McCarthy of MIT. LISP is the second oldest programming language still in common use.

Logo

print [Hello World]

    Logo was created in 1967 by Daniel G. Bobrow, Wally Feurzeig, and Seymour Papert.

Modula-2

MODULE HelloWorld;
FROM InOut IMPORT WriteString, WriteLn;
BEGIN
   WriteString('Hello World');
   WriteLn;
END HelloWorld.

    Modula (MODUlar LAnguage) was created by Niklaus Wirth, who started work in 1977. Modula-2 was released in 1980.

Oberon

MODULE HelloWorld;
IMPORT Out;
BEGIN
   Out.Open;
   Out.String('Hello World');
END HelloWorld.

    Oberon (named for a moon of Uranus) was created in 1986 by Niklaus Wirth.

Pascal

PROGRAM HelloWorld (OUTPUT);
BEGIN
   WRITELN('Hello World');
END.

    Pascal (named for French religious fanatic and mathematician Blaise Pascal) was created in 1970 by Niklaus Wirth.

Perl

print "Hello World\n";

    Perl (Practical Extracting and Report Language) was created by Larry Wall in 1987.

PHP

<?php
   echo "Hello World\n";
?>

    PHP (PHP Hypertext Processor) was created by Rasmus Lerdorf in 1995.

PL/I

HELLO: PROCEDURE OPTIONS (MAIN);
   PUT SKIP LIST('HELLO WORLD');
END HELLO;

    PL/I (Programming Language One) was created in 1964 at IBM’s Hursley Laboratories in the United Kingdom.

PostScript

/Courier findfont
14 scalefont
setfont
0 0 moveto
(Hello World) show
showpage

    PostScript was created in 1984 by John Warnock and Chuck Geschke at Adobe.

Prolog

?- write('Hello World'), nl.

    Prolog (PROgramming LOGic) was created in 1972 by Alan Colmerauer with Philippe Roussel.

Python

    For Python 2.6 and earlier:

print: "Hello World"

    For Python 3.0 and later:

print("Hello World")

    Python (named for Monty Python Flying Circus) was created in 1991 by Guido van Rossum.

Ruby

"Hello World\n".display

    Ruby was created in 1995 by Yukihiro Matsumoto.

Shell Script (BASH)

echo Hello World

SmallTalk

'Hello World' out.

    SmallTalk was created in 1969 at Xerox PARC by a team led by Alan Kay, Adele Goldberg, Ted Kaehler, and Scott Wallace.

SNOBOL

   OUTPUT = "Hello World"
END

    SNOBOL (StroNg Oriented symBOli Language) was created in 1962.

SQL

SELECT "Hello World"

    SQL (Standard Query Language) was designed by Donald D. Chamberlin and Raymond F. Boyce of IBM in 1974.

other

   “26. There will always be things we wish to say in our programs that in all known languages can only be said poorly.” —Alan Perlis, Epigrams on Programming, ACM’s SIGPLAN Notices Volume 17, No. 9, September 1982, pages 7-13


free music player coding example

    Coding example: I am making heavily documented and explained open source code for a method to play music for free — almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).

    View music player in action: www.musicinpublic.com/.

    Create your own copy from the original source code/ (presented for learning programming).


return to table of contents
free downloadable college text book

view text book
HTML file

Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.

previous page next page
previous page next page

free computer programming text book project

Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.

If you like the idea of this project,
then please donate some money.

send donations to:
Milo
PO Box 1361
Tustin, California 92781

Supporting the entire project:

    If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)

more information on donating

Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.


Google


Made with Macintosh

    This web site handcrafted on Macintosh computers using Tom Bender’s Tex-Edit Plus and served using FreeBSD .

Viewable With Any Browser


    †UNIX used as a generic term unless specifically used as a trademark (such as in the phrase “UNIX certified”). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.

    Names and logos of various OSs are trademarks of their respective owners.

    Copyright © 2007, 2010, 2011 Milo

    Created: September 8, 2007

    Last Updated: March 3, 2011


return to table of contents
free downloadable college text book

previous page next page
previous page next page