The original sin of Kemeny and Kurtz when they designed BASIC in 1963 was not in fact their embrace of the GOTO statement but their failure to embrace structured programming. While a relatively new concept, having emerged in the late 1950s, structured programming was already familiar to Kurtz, who had implemented an ALGOL 58 and then ALGOL 60 compiler called Dartmouth ALGOL 30.

Structured programming in ALGOL 60 included—

  • Blocks: bracketed by begin and end keywords (and by actual brackets in BCPL, C and their descendants)
  • Full conditional statements: ifthenelse constructs, which could be used as statements or functions
  • Loops: for loops with while and until clauses.
Structured program patterns

Here are two examples of conditional functions, returning a value or a switch label respectively:

min := if a < b then a else b

goto if x > y then s else t

That latter format, though as a statement not a function, would be the only version that made it into BASIC (without the else). The initial IF statement in BASIC only supported branching to a line number (e.g., IF X>Y THEN 100). (In ALGOL 60, lines could take labels, known as switch identifiers.)

Of course, in ALGOL 60 you could also use the if-then-else as statements:

if a<b then m := a else m := b

This innovation of a conditional statement rather than line number came to other implementations of BASIC before Dartmouth implemented it. It’s fairly trivial to support: the first Tiny BASIC specification only supported this format, rather than what came to be called “the implied GOTO” (the original BASIC IF THEN). Despite that, support for the conditional statement was uncommon. In fact, in 101 Computer Games (third edition, 1975), the author felt the need to call it out: “This program is written in DIGITAL PDP-II BASIC. The only unusual feature is that an IF statement may have the form: IF (CONDITION) THEN (STATEMENT).”

Sadly, it was a long time before any BASICs supported ELSE. Not a single game in BASIC Computer Games used it. Not a single Tiny BASIC supported it. ALGOL’s else was perhaps implemented in BASIC by Digital Equipment or HP before Dartmouth implemented it. As late as 1984, The BASIC Handbook provided a test to see if your microcomputer’s BASIC implementation had an ELSE statement.

While ALGOL 60 supported blocks, you could have imagined this being implemented in early BASIC in IF statements as IF X THEN Y=1: Z=1: T=1 ELSE Y=2.

With its FOR statement, BASIC only supported counting, no WHILE/UNTIL loops. Again, these would not have been hard to implement. National Industrial Basic Language (NIBL), a Tiny BASIC, supported DO/UNTIL in 1976, for instance.

The original BASIC language did support one-line function declarations (DEF FN) but the variable name used as the parameter was global, causing side effects in code.

In their design of BASIC, Kemeny and Kurtz relied for inspiration too much on FORTRAN and not enough on ALGOL. Given the phenomenal success of BASIC, this was a missed opportunity that would stunt the spread of structured programming by at least ten years. As the Wikipedia article on ALGOL 60 puts it—

ALGOL 60 inspired many languages that followed it. Tony Hoare remarked: “Here is a language so far ahead of its time that it was not only an improvement on its predecessors but also on nearly all its successors.”[4][5]

Structured programming was a significant level of abstraction above the CPU, but many didn’t realize how valuable that was yet. Including, alas, Kemeny and Kurtz.

See also:

Photo Credits: © 1964 General Electric Company (GE); Alnaling on Wikipedia.