hn.today

The 'else' keyword is probably a literal translation from German (2020)

github.com8 points0 comments
Screenshot of The 'else' keyword is probably a literal translation from German (2020)

The piece investigates how “else” entered programming languages, arguing that the keyword was not an obvious extension of everyday English but a feature that had to be created. Early computers used conditional jumps to redirect execution, and early languages developed different ways to express those decisions. Fortran’s “if” sent control to different locations according to whether a value was negative, zero, or positive; Flow-Matic made the comparison easier to understand and used “otherwise” for an unmatched case. These systems framed conditionals mainly as changes in program flow.

The likely source of “else” is a 1958 German proposal for a shared, machine-independent language. Its “if” statements used Boolean conditions, while a separate “case” construct included “else” for the situation in which none of the listed cases applied. The proposal was written in German and translated hastily into English, leading the author to suggest that “else” may be a literal rendering of a German word chosen for that fallback. The later merged proposal, which became Algol, did not retain this standalone “else” form; it used alternatives such as “or if.” The history is difficult to pin down because the original German text is unavailable and subsequent proposals changed the conditional syntax.

Read on github.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.