Why 'Else' Had to Be Invented
The article traces how if-then-else became a fundamental programming construct, starting with early computers. ENIAC, described in a 1946 report by Haskell Curry and Willa Wyatt, could perform different instructions based on calculations. Early higher-level languages like those for the Whirlwind computer adapted this as conditional jumps. Fortran, the first popular programming language, generalized the concept with a three-way conditional. Grace Murray Hopper’s Flow-Matic introduced “otherwise” to make conditions easier to express.
In 1958, American and German computing organizations merged their proposals for a standard, machine-independent language that became ALGOL. The German proposal allowed any boolean expression to control conditions and introduced a “case” form with “else” for the default case. The American proposal used arrow notation and short-circuited when conditions were true. The merged ALGOL 58 combined these ideas but notably did not include “else” in its if statement; instead, it featured “if either” for sequential conditions.
The article notes uncertainty about why the German team named the construct “else,” attributing this to a hasty translation from German. Later developments, including John Backus’s work on formal grammars and John McCarthy’s 1957 LISP proposal introducing conditional expressions rather than statements, further evolved the construct’s representation in programming languages.
Read the full article
Continue reading at Hacker News →This is an AI-generated summary. Read the original for the full story.