Programmer's Wiki

Algol 60 was the first structured programming language containing blocks whose range defined the scope of variables, i.e. the variables declared within the block was accessible for code statements within that block only:

   integer A, X; comment outer X;
   A := 3;
   X := 5;
      integer X, Y; comment inner X;
      X := 4; comment inner X assigned here;
      Y := 8;
   print (X); comment prints "5", not "4" since this is outer scope;
Y := 12; comment illegal! Y not defined in outer scope;

This kind of declaration scope was introduced with Algol 60, and soon became the programming language standard of the many programming languages in the Algol class. Notable exception was BASIC, introduced after Algol, yet having no declaration scope.


An earlier Algol 58, also called IAL, was defined by IFIP (International Federation for Information Processing), but this language was so heavily reworked during 1960 that the new language Algol 60 was essentially a new language. Algol 58 didn't have blocks.

Algol 60 was popular both for algorithm publishing, and by implementations of which none was really compatible to any other implementation. Many Algol 60 derived languages occured for a long time.

In 1967 Dahl and Nygaard published the last grand Algol 60, called Simula 67. It contained classes that was later copied by Stroustrup into C++.

In 1968 IFIP published a new language called Algol 68. The new language was nothing like any earlier Algol and was heavily criticised for being an entirely new language with no abstractions inherited from Algol 60, and for being very hard to implement. Thereby the Algol 60 chain was essentially broken, but some superficial traits from Algol 60 were borrowed over to the language BCPL and it's extremely successful successor C.

Hello world[]

Essentially a hello world couldn't be written in Algol 60 since there was no printout subroutine defined in the language. However, presuming that a local implementation had the function outstring() – after the Simula 67 pattern – a hello world could look like:

    outstring(‘Hello world!’)


Blocks and scope[]

The language contained blocks starting with begin and ending with end. Statements were separated by semicolon, statements were not ended by semicolon like in C – this might seem a ridiculous distinction but compare Algol-60

   integer X;
   X := 23

with C:s counterpart

   int X;
   X = 23;

A semicolon after 23 is optional in Algol-60, making the variant

   integer X;
   X := 23;

optional, while the statement

   int X;
   X = 23

where the final 23 is not followed by a semicolon is illegal!

Data types[]


Algol 60 had the scalar datatypes Boolean, integer, real and string. integer and real had operators and functions:


+ plus - minus × times / division ÷ integer division ↑ exponentiation abs(x) absolute value sign(x) signum entier(x) ceiling sqrt(x) square root exp(x) ex ln(x) natural logarithm sin(x) sine cos(x) cosine arctan(x) arcus tangent


< less ≤ less or equal = equal ≥ greater or equal > greater ≠ not equal

logic operators:

≡ equivalence ⊃ implication ∧ and ∨ or ¬ not

Algol was defined before ASCII, and so did use many exotic characters that became generally available for everyone only when Unicode was established on the computer market.

There were never any functions defined for pure Algol 60. Simula defined a vast set of character, string and set functions.


Arrays of integers and reals could be defined according to the pattern:

integer array A[start:end];


real array A[start:end];

or just

array A[start:end];

in which case real was defaulted. Array elements were accessed in the modern way:




C++ Arrays


switch was a weird array data type containing jump labels. Such arrays could be used indexed as a label statement in a go to clause, such as

go to S[N]

jumping to a position determined by the contents of switch S at the index position of N. This was later on declared evil by many PL designers and programmers, since the jump destination is not easily predictable by any program analysator. Switches were retained for compatibility in Simula 67, but made did never occur in any other programming language. The switches of C and other curly-braces-PL:s are quite dissimilar, and would in non-curly languages be called select clauses.