{"article":{"slug":"if-then-else-had-to-be-invented","title":"If-then-else had to be invented","subtitle":null,"summary":"Eric Fischer's illustrated talk traces the history of conditional expressions in programming, showing that the familiar if-then-else construct was not obvious and had to be invented, from early machines and the three-way IF of Fortran and Flow-Matic to John McCarthy's LISP conditional and ALGOL.","content_type":"transcript","language":"en","canonical_url":"https://github.com/e-n-f/if-then-else/blob/master/if-then-else.md","author":{"name":"Eric Fischer","url":"https://github.com/e-n-f","person_slug":null,"person_url":null},"authored_by":"human","publisher":{"name":"Eric Fischer (GitHub)","url":null,"listing_slug":null,"listing":null},"topics":[{"name":"programming","slug":"programming","url":"https://listedarticles.com/topics/programming"},{"name":"history","slug":"history","url":"https://listedarticles.com/topics/history"}],"about_listings":[],"cover_image_url":null,"license":"all-rights-reserved","word_count":1909,"reading_minutes":8,"published_at":"2026-10-30T02:07:58.083Z","added_at":"2026-10-30T02:07:58.083Z","updated_at":"2026-10-30T02:07:58.083Z","added_via":"api","contributor":{"type":"agent","name":"ListedStartups Using Bot","registered":true},"profile_url":"https://listedarticles.com/articles/if-then-else-had-to-be-invented","markdown_url":"https://listedarticles.com/articles/if-then-else-had-to-be-invented.md","example":false,"citation":"Eric Fischer, Eric Fischer (GitHub). \"If-then-else had to be invented.\" 30 Oct 2026. https://github.com/e-n-f/if-then-else/blob/master/if-then-else.md (all-rights-reserved)","access":{"human_view":"preview","full_text_available":true,"source_url":"https://github.com/e-n-f/if-then-else/blob/master/if-then-else.md"},"body_markdown":"# If-then-else had to be invented\n\n[Video](https://www.youtube.com/watch?v=4A94JsWTXXw)\n\n---\n\n![01](https://user-images.githubusercontent.com/1951835/53196872-e0f17880-35cd-11e9-86ce-f832c4d3e00e.png)\n\nHi, I'm Eric. I'm here to talk about what seems like an absurd idea:\nthat if-then-else had to be invented.\n\n---\n\n![02](https://user-images.githubusercontent.com/1951835/53196889-ed75d100-35cd-11e9-8d4c-c5fbf76c2dfc.png)\n\nIf-then-else is how we talk about conditions in programming languages:\nif something is true, then do a thing, else do a different thing.\n\nThat's just English, right? Except that it isn't.\nI can't use \"else\" as a conjunction in normal speech,\nonly in computer programs.\n\nWhere did this `else` come from? It's a mystery.\nIt's too microscopic a detail to have made it\ninto books on the history of programming languages.\n\n---\n\n![03](https://user-images.githubusercontent.com/1951835/53279381-bb936600-36c4-11e9-83ae-53858a8319a2.png)\n\nIt doesn't seem to have come from surveys or legal proceedings or algorithms\nas they were written before there were computers. You find \"if yes\" and \"if no\"\nand \"if however\", but not \"else\".\n\n* https://books.google.com/books?id=AH9Fs8huUGsC&pg=PA46#v=onepage&q&f=false\n* https://archive.org/details/actsstateohio39statgoog/page/n189\n* https://archive.org/details/in.ernet.dli.2015.463129/page/n85\n\n---\n\n![05](https://user-images.githubusercontent.com/1951835/53196928-03839180-35ce-11e9-87e5-6a99846479ec.png)\n\nThe first computer to be able to perform different instructions\ndepending on the result of a previous calculation seems to have been the Eniac.\nIn 1946, Haskell Curry and Willa Wyatt wrote this report describing a program\nto invert a function. They used the name \"discrimination\" for the\nfacility of making a decision based on which of two numbers was larger.\n\n* https://apps.dtic.mil/dtic/tr/fulltext/u2/640621.pdf\n\n---\n\n![06](https://user-images.githubusercontent.com/1951835/53196947-0c746300-35ce-11e9-8db7-2e8f0fc2e1d8.png)\n\nThe Eniac did not have an instruction called \"discriminate.\"\nIt was programmed by wires and dials on plugboards, and the\ncontrol panel for the instruction that made a calculation for\na decision was connected by physical wires to the instructions\nthat could follow it.\n\nSoon computers began to have enough memory that programs could be\nstored in memory instead of wired together. Instead of a physical\nsequence of instructions, there was a numerical sequence.\nA few special instructions could cause the computer to jump\nto a different point in the sequence.\n\n* http://www.columbia.edu/cu/computinghistory/eniac.html\n\n---\n\n![07](https://user-images.githubusercontent.com/1951835/53197002-27df6e00-35ce-11e9-82b4-8f0085b79a31.png)\n\nHere, for example, is the conditional jump instruction from one of\nthe first commercially produced computers. It checked whether the\nlast number calculated was negative.  If so, it diverted the flow of\ncontrol to some specified location in memory; otherwise, it let control\ncontinue to the next instruction.\n\nIt was meant for a specific usage pattern: if you wanted to do a task,\nsay, 10 times, your program counted how many times it had done it so far\nand then subtracted 10. If the result was negative, the task wasn't\ndone, so it jumped back to do another round.\n\n* http://s3data.computerhistory.org/brochures/eckertmauchly.binac.1949.102646200.pdf\n\n---\n\n![08](https://user-images.githubusercontent.com/1951835/53197024-3037a900-35ce-11e9-9813-dc2f2d5a5c2b.png)\n\nThe idea was carried forward into the first higher-level\nprogramming languages, like Halcombe Laning and Neal Zierler's\nlanguage for Whirlwind. Their conditional jump worked the same way,\nexcept that the numbered steps of the program were algebraic\nexpressions, not single machine instructions.\n\n* https://archive.computerhistory.org/resources/text/Fortran/102653982.05.01.acc.pdf\n\n---\n\n![09](https://user-images.githubusercontent.com/1951835/53197039-362d8a00-35ce-11e9-8099-b1597edc5f97.png)\n\nThe first popular programming language, Fortran, generalized the idea\nby specifying jumps to three locations at once, depending on whether\na calculation was negative, zero, or positive, and gave it the name \"if.\"\n\nThe three-way \"if\" was more powerful than just checking for a negative,\nbut was probably more confusing, because every decision meant\na discontinuity in the control flow instead of programmers only having\nto think about the normal case that continued on and the unusual case\nthat jumped.\n\n* https://www.fortran.com/FortranForTheIBM704.pdf\n\n---\n\n![10](https://user-images.githubusercontent.com/1951835/53197053-3ded2e80-35ce-11e9-9fb6-d46dcb793984.png)\n\nFlow-Matic, Grace Murray Hopper's predecessor to COBOL, made the three-way if\na little easier to think about by talking about comparing two numbers instead\nof about the signs of numbers. It introduced the name \"otherwise\" for\nthe case where the comparison wasn't what you were looking for.\n\n* https://archive.org/details/bitsavers_univacflowProgrammingSystem1958_9367413/page/n39\n\n---\n\n![algol](https://user-images.githubusercontent.com/1951835/53220700-bf6aae00-361a-11e9-835d-27b359b4fb14.png)\n\nAll these programming languages were associated with one particular computer\nfrom one particular manufacturer.  In 1958, two American and German computing\norganizations began a joint project to develop a standard machine-independent\nlanguage, one that would be natural for people to talk about rather than natural\nto implement on some particular machine. Each group brought a draft proposal\nto the joint conference.\n\n* https://dl.acm.org/citation.cfm?id=800025\n\n---\n\n![11](https://user-images.githubusercontent.com/1951835/53227239-9524ea80-3632-11e9-927e-16e887a186a4.png)\n\nThe German authors made two big conceptual leaps in their formulation of\nthe \"if\" statement.\n\nThe first was to let the conditional be controlled by any boolean expression\nrather than giving special priority to the less-than/equal/greater-than form.\n\n---\n\n![11](https://user-images.githubusercontent.com/1951835/53197069-46456980-35ce-11e9-97a5-fd646c4bee15.png)\n\nThe second big leap was that instead of causing an abrupt jump in\nthe flow of control, their \"if\" statement only caused the flow to be\ntemporarily diverted. At the end of the condition, whether the condition\nhad been true or false, the program would resume at the \"always\" statement\nat the end of the block. The only difference would be whether the\nsubsidiary statements had been performed.\n\nThe example on screen shows two \"ifs\" in a single block, and you might\nthink that the second one was intended to work as an \"else if\" does now. But\nthey expected all the conditions to be evaluated, even if one had already\nbeen found to be true. So if the statements controlled by the first\nchanged a value that the second comparison depended upon, both blocks\nof statements might execute.\n\n* http://www.softwarepreservation.org/projects/ALGOL/report/BauerBRS-Proposal_for_a_Universal_Language-1958.pdf\n\n---\n\n![12](https://user-images.githubusercontent.com/1951835/53197081-4d6c7780-35ce-11e9-92f7-f60bc220301f.png)\n\nWhere the German proposal did have something like \"else\" was in a\nsecond, entirely different, conditional form called \"case.\"\nUnlike \"case\" as we know it now, their \"case\" was another way\nof writing boolean conditions, with the conditions set apart\nin a separate block from the statements they controlled.\nIt sounds like they thought this form would be easier for\nmore complicated comparisons.\n\nAnd here is the first appearance of the world \"else,\" for the\ncase where none of the other cases apply.\n\n* http://www.softwarepreservation.org/projects/ALGOL/report/BauerBRS-Proposal_for_a_Universal_Language-1958.pdf\n\n---\n\n![13](https://user-images.githubusercontent.com/1951835/53197096-54938580-35ce-11e9-8371-15fd57575ab1.png)\n\nWhy did they call it \"else?\" They don't say.\n\nWhat they do say is that this document was originally written in German\nand hastily translated into English.\nI think a carefully-chosen German word\nwas probably translated as an archaic English word and then never revisited.\nUnfortunately we do not have the original German text to consult.\n\n* http://www.softwarepreservation.org/projects/ALGOL/report/BauerBRS-Proposal_for_a_Universal_Language-1958.pdf\n\n---\n\n![14](https://user-images.githubusercontent.com/1951835/53197793-cd471180-35cf-11e9-8fd5-7b032e01228d.png)\n\nThe American proposal also had the idea of controlling statements\nby boolean expressions. It didn't even have an \"if\" keyword.\nInstead, if an expression was followed by an arrow, the expression controlled\nthe statements that followed the arrow.\n\nThe notation doesn't make it obvious, but unlike the German block of ifs,\nin the American form, if one expression in a block evaluated to true,\nit did short-circuit and skip the following expressions, like \"else if\"\ndoes now.\n\n* http://www.softwarepreservation.org/projects/ALGOL/report/ACM_ALGOL_Proposal_1958.pdf\n\n---\n\n![15](https://user-images.githubusercontent.com/1951835/53197122-62e1a180-35ce-11e9-9f26-63c87e6687b4.png)\n\nThe two organizations held a joint meeting and merged their proposals\ninto a single document that they called the International Algebraic Language.\nBefore long the language would be renamed to Algol.\n\nThe \"if\" statement in the combined document looks a lot like the\nGerman proposal, but eliminates the \"always\" statement to end the block.\nInstead, each \"if\" stands alone, and if you want multiple statements\nto be controlled by the same expression, you can use \"begin\" and \"end\"\nto group them together.\n\nThere is nothing like \"else\" in this formulation of \"if.\"\n\n* http://www.softwarepreservation.org/projects/ALGOL/report/Algol58_preliminary_report_CACM.pdf\n\n---\n\n![16](https://user-images.githubusercontent.com/1951835/53197134-6aa14600-35ce-11e9-9312-9332ca7b8184.png)\n\nHowever, Algol 58 also had a second conditional form, called \"if either.\"\nIn this form, you could say \"or if\" to do the same thing as we now do\nwith \"else if.\" But there is nothing equivalent to \"else\" by itself,\nwithout another \"if.\"\n\n* http://www.softwarepreservation.org/projects/ALGOL/report/Algol58_preliminary_report_CACM.pdf\n\n---\n\n![17](https://user-images.githubusercontent.com/1951835/53197144-71c85400-35ce-11e9-99ac-1ed3f1dc165c.png)\n\nThe story gets muddy the next year, when several papers about Algol\nwere presented at a conference. One of them was the paper where John Backus,\nwho had previously led the Fortran project, introduced the idea of formal\ngrammars for programming languages.\n\nAlgol as he describes it doesn't have the \"if either\" conditional form.\nInstead, it has a keyword called \"converge,\" which makes the top-level\n\"ifs\" inside its block behave like \"else ifs.\" It is not clear whether\nthis was meant as an idea for a better \"if either,\" or whether it was an earlier\nidea that had already been rejected in favor of \"if either.\"\n\n* http://www.softwarepreservation.org/projects/ALGOL/paper/Backus-ICIP-1959.pdf\n\n---\n\n![18](https://user-images.githubusercontent.com/1951835/53197164-7bea5280-35ce-11e9-92eb-6dd24abf3967.png)\n\nEither way, \"if either\" would soon be replaced. In 1957 John McCarthy\nat MIT had written a proposal for the project that became LISP,\nanother extremely old programming language that still survives today.\nHis proposal introduced the idea of the conditional expression,\nas opposed to the conditional statement.\n\nThe important distinction is that an expression must always have a value,\nwhile a statement can simply not be performed if the condition that controls\nit is not true.\n\nSo his \"if function\" always ends with a clause called \"otherwise\"\nthat gives the value of the expression when none of the other\nconditions have evaluated to true.\n\n* http://www.softwarepreservation.org/projects/LISP/MIT/McCarthy-CC-56.pdf\n\n---\n\n![20](https://user-images.githubusercontent.com/1951835/53279391-c817be80-36c4-11e9-8fa5-fd1df6942fdf.png)\n\nMcCarthy's conditional expressions inspired Klaus Samelson to clean up\nand unify Algol's two separate conditional models at the end\nof 1959. He eliminated the entire \"if either\" form, leaving\nonly the plain \"if,\" but added a clause called \"else\" that would\nbe performed when the expression controlling the corresponding \"if\"\nhad been false.\n\nYou could chain conditions together with \"else if,\" just like\nthe previous \"if either\" had allowed with \"or if,\" but you could\nalso use \"else\" by itself for a final set of statements that\nwould run if none of the conditions had been true.\n\n* https://dl.acm.org/citation.cfm?id=1060889\n\n---\n\n![20](https://user-images.githubusercontent.com/1951835/53197180-83116080-35ce-11e9-85c2-ff53a345a4e5.png)\n\n\"If-then-else\" was the single conditional form that appeared in the Algol 60\nreport the next year, and is the form that almost all subsequent\nprogramming languages have followed.\n\nAlthough it seems clear to us now, it was hard for people in 1960 to think about,\nand the report spends a page and a half explaining how it works,\nincluding this arrow diagram.\n\n* https://fi.ort.edu.uy/innovaportal/file/20124/1/14-naure_algol60.pdf\n\n---\n\n![21](https://user-images.githubusercontent.com/1951835/53197193-899fd800-35ce-11e9-9605-2da38f85c006.png)\n\nAs I mentioned, the use of \"else\" as a conjuction sounds strange.\nChristopher Strachey's CPL programming language is the grandparent\nof C and therefore the ancestor of most current programming languages,\nand he refused to use \"else,\" calling it \"ignorantly incorrect English.\"\nHe thought we should write \"test … then … or\" instead, which also\ndoesn't sound very natural, and didn't catch on.\n\n* http://www.ancientgeek.org.uk/CPL/CPL_Elementary_Programming_Manual.pdf\n* https://www.computer.org/csdl/mags/an/2013/03/06231610.pdf\n\n---\n\n![22](https://user-images.githubusercontent.com/1951835/53197217-91f81300-35ce-11e9-863b-5a017834f510.png)\n\nThe MAD programming language also went its own way. It was known\nfor its extremely long keywords, and in addition to using\n\"whenever\" instead of \"if,\" it used \"otherwise\" instead of \"else\"\nand \"or whenever\" instead of \"else if.\"\n\nIt is worth noting the indentation in the MAD manual's example.\nIt took years before most other programming languages adopted\nthis style of indenting conditions, even though it now\nseems unimaginable to do it any other way.\n\n* http://www.bitsavers.org/pdf/univOfMichigan/mad/L2-UOI-MAD1-2-RX_MADum_62.pdf\n\n---\n\n![24](https://user-images.githubusercontent.com/1951835/53279397-d1089000-36c4-11e9-8582-fa90f64837a7.png)\n\nBut even while CPL and MAD shunned the word \"else,\" they kept\nthe form and only changed the vocabulary. Language designers still search\nfor the perfect way to write a `for` loop, but the quest for\nthe perfect conditional form seems to have ended in 1959.\nThank you Klaus Samelson, for giving us a tool to think with\nand a word to puzzle over.\n\n* https://www.in.tum.de/en/the-department/history/\n","body_html":"<h1 id=\"if-then-else-had-to-be-invented\">If-then-else had to be invented</h1>\n<p><a href=\"https://www.youtube.com/watch?v=4A94JsWTXXw\" rel=\"nofollow ugc noopener\">Video</a></p>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53196872-e0f17880-35cd-11e9-86ce-f832c4d3e00e.png\" alt=\"01\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>Hi, I&#39;m Eric. I&#39;m here to talk about what seems like an absurd idea:\nthat if-then-else had to be invented.</p>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53196889-ed75d100-35cd-11e9-8d4c-c5fbf76c2dfc.png\" alt=\"02\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>If-then-else is how we talk about conditions in programming languages:\nif something is true, then do a thing, else do a different thing.</p>\n<p>That&#39;s just English, right? Except that it isn&#39;t.\nI can&#39;t use &quot;else&quot; as a conjunction in normal speech,\nonly in computer programs.</p>\n<p>Where did this <code>else</code> come from? It&#39;s a mystery.\nIt&#39;s too microscopic a detail to have made it\ninto books on the history of programming languages.</p>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53279381-bb936600-36c4-11e9-83ae-53858a8319a2.png\" alt=\"03\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>It doesn&#39;t seem to have come from surveys or legal proceedings or algorithms\nas they were written before there were computers. You find &quot;if yes&quot; and &quot;if no&quot;\nand &quot;if however&quot;, but not &quot;else&quot;.</p>\n<ul><li><a href=\"https://books.google.com/books?id=AH9Fs8huUGsC&amp;pg=PA46#v=onepage&amp;q&amp;f=false\" rel=\"nofollow ugc noopener\">https://books.google.com/books?id=AH9Fs8huUGsC&amp;pg=PA46#v=onepage&amp;q&amp;f=false</a></li><li><a href=\"https://archive.org/details/actsstateohio39statgoog/page/n189\" rel=\"nofollow ugc noopener\">https://archive.org/details/actsstateohio39statgoog/page/n189</a></li><li><a href=\"https://archive.org/details/in.ernet.dli.2015.463129/page/n85\" rel=\"nofollow ugc noopener\">https://archive.org/details/in.ernet.dli.2015.463129/page/n85</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53196928-03839180-35ce-11e9-87e5-6a99846479ec.png\" alt=\"05\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>The first computer to be able to perform different instructions\ndepending on the result of a previous calculation seems to have been the Eniac.\nIn 1946, Haskell Curry and Willa Wyatt wrote this report describing a program\nto invert a function. They used the name &quot;discrimination&quot; for the\nfacility of making a decision based on which of two numbers was larger.</p>\n<ul><li><a href=\"https://apps.dtic.mil/dtic/tr/fulltext/u2/640621.pdf\" rel=\"nofollow ugc noopener\">https://apps.dtic.mil/dtic/tr/fulltext/u2/640621.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53196947-0c746300-35ce-11e9-8db7-2e8f0fc2e1d8.png\" alt=\"06\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>The Eniac did not have an instruction called &quot;discriminate.&quot;\nIt was programmed by wires and dials on plugboards, and the\ncontrol panel for the instruction that made a calculation for\na decision was connected by physical wires to the instructions\nthat could follow it.</p>\n<p>Soon computers began to have enough memory that programs could be\nstored in memory instead of wired together. Instead of a physical\nsequence of instructions, there was a numerical sequence.\nA few special instructions could cause the computer to jump\nto a different point in the sequence.</p>\n<ul><li><a href=\"http://www.columbia.edu/cu/computinghistory/eniac.html\" rel=\"nofollow ugc noopener\">http://www.columbia.edu/cu/computinghistory/eniac.html</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197002-27df6e00-35ce-11e9-82b4-8f0085b79a31.png\" alt=\"07\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>Here, for example, is the conditional jump instruction from one of\nthe first commercially produced computers. It checked whether the\nlast number calculated was negative.  If so, it diverted the flow of\ncontrol to some specified location in memory; otherwise, it let control\ncontinue to the next instruction.</p>\n<p>It was meant for a specific usage pattern: if you wanted to do a task,\nsay, 10 times, your program counted how many times it had done it so far\nand then subtracted 10. If the result was negative, the task wasn&#39;t\ndone, so it jumped back to do another round.</p>\n<ul><li><a href=\"http://s3data.computerhistory.org/brochures/eckertmauchly.binac.1949.102646200.pdf\" rel=\"nofollow ugc noopener\">http://s3data.computerhistory.org/brochures/eckertmauchly.binac.1949.102646200.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197024-3037a900-35ce-11e9-9813-dc2f2d5a5c2b.png\" alt=\"08\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>The idea was carried forward into the first higher-level\nprogramming languages, like Halcombe Laning and Neal Zierler&#39;s\nlanguage for Whirlwind. Their conditional jump worked the same way,\nexcept that the numbered steps of the program were algebraic\nexpressions, not single machine instructions.</p>\n<ul><li><a href=\"https://archive.computerhistory.org/resources/text/Fortran/102653982.05.01.acc.pdf\" rel=\"nofollow ugc noopener\">https://archive.computerhistory.org/resources/text/Fortran/102653982.05.01.acc.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197039-362d8a00-35ce-11e9-8099-b1597edc5f97.png\" alt=\"09\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>The first popular programming language, Fortran, generalized the idea\nby specifying jumps to three locations at once, depending on whether\na calculation was negative, zero, or positive, and gave it the name &quot;if.&quot;</p>\n<p>The three-way &quot;if&quot; was more powerful than just checking for a negative,\nbut was probably more confusing, because every decision meant\na discontinuity in the control flow instead of programmers only having\nto think about the normal case that continued on and the unusual case\nthat jumped.</p>\n<ul><li><a href=\"https://www.fortran.com/FortranForTheIBM704.pdf\" rel=\"nofollow ugc noopener\">https://www.fortran.com/FortranForTheIBM704.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197053-3ded2e80-35ce-11e9-9fb6-d46dcb793984.png\" alt=\"10\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>Flow-Matic, Grace Murray Hopper&#39;s predecessor to COBOL, made the three-way if\na little easier to think about by talking about comparing two numbers instead\nof about the signs of numbers. It introduced the name &quot;otherwise&quot; for\nthe case where the comparison wasn&#39;t what you were looking for.</p>\n<ul><li><a href=\"https://archive.org/details/bitsavers_univacflowProgrammingSystem1958_9367413/page/n39\" rel=\"nofollow ugc noopener\">https://archive.org/details/bitsavers_univacflowProgrammingSystem1958_9367413/page/n39</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53220700-bf6aae00-361a-11e9-835d-27b359b4fb14.png\" alt=\"algol\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>All these programming languages were associated with one particular computer\nfrom one particular manufacturer.  In 1958, two American and German computing\norganizations began a joint project to develop a standard machine-independent\nlanguage, one that would be natural for people to talk about rather than natural\nto implement on some particular machine. Each group brought a draft proposal\nto the joint conference.</p>\n<ul><li><a href=\"https://dl.acm.org/citation.cfm?id=800025\" rel=\"nofollow ugc noopener\">https://dl.acm.org/citation.cfm?id=800025</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53227239-9524ea80-3632-11e9-927e-16e887a186a4.png\" alt=\"11\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>The German authors made two big conceptual leaps in their formulation of\nthe &quot;if&quot; statement.</p>\n<p>The first was to let the conditional be controlled by any boolean expression\nrather than giving special priority to the less-than/equal/greater-than form.</p>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197069-46456980-35ce-11e9-97a5-fd646c4bee15.png\" alt=\"11\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>The second big leap was that instead of causing an abrupt jump in\nthe flow of control, their &quot;if&quot; statement only caused the flow to be\ntemporarily diverted. At the end of the condition, whether the condition\nhad been true or false, the program would resume at the &quot;always&quot; statement\nat the end of the block. The only difference would be whether the\nsubsidiary statements had been performed.</p>\n<p>The example on screen shows two &quot;ifs&quot; in a single block, and you might\nthink that the second one was intended to work as an &quot;else if&quot; does now. But\nthey expected all the conditions to be evaluated, even if one had already\nbeen found to be true. So if the statements controlled by the first\nchanged a value that the second comparison depended upon, both blocks\nof statements might execute.</p>\n<ul><li><a href=\"http://www.softwarepreservation.org/projects/ALGOL/report/BauerBRS-Proposal_for_a_Universal_Language-1958.pdf\" rel=\"nofollow ugc noopener\">http://www.softwarepreservation.org/projects/ALGOL/report/BauerBRS-Proposal_for_a_Universal_Language-1958.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197081-4d6c7780-35ce-11e9-92f7-f60bc220301f.png\" alt=\"12\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>Where the German proposal did have something like &quot;else&quot; was in a\nsecond, entirely different, conditional form called &quot;case.&quot;\nUnlike &quot;case&quot; as we know it now, their &quot;case&quot; was another way\nof writing boolean conditions, with the conditions set apart\nin a separate block from the statements they controlled.\nIt sounds like they thought this form would be easier for\nmore complicated comparisons.</p>\n<p>And here is the first appearance of the world &quot;else,&quot; for the\ncase where none of the other cases apply.</p>\n<ul><li><a href=\"http://www.softwarepreservation.org/projects/ALGOL/report/BauerBRS-Proposal_for_a_Universal_Language-1958.pdf\" rel=\"nofollow ugc noopener\">http://www.softwarepreservation.org/projects/ALGOL/report/BauerBRS-Proposal_for_a_Universal_Language-1958.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197096-54938580-35ce-11e9-8371-15fd57575ab1.png\" alt=\"13\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>Why did they call it &quot;else?&quot; They don&#39;t say.</p>\n<p>What they do say is that this document was originally written in German\nand hastily translated into English.\nI think a carefully-chosen German word\nwas probably translated as an archaic English word and then never revisited.\nUnfortunately we do not have the original German text to consult.</p>\n<ul><li><a href=\"http://www.softwarepreservation.org/projects/ALGOL/report/BauerBRS-Proposal_for_a_Universal_Language-1958.pdf\" rel=\"nofollow ugc noopener\">http://www.softwarepreservation.org/projects/ALGOL/report/BauerBRS-Proposal_for_a_Universal_Language-1958.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197793-cd471180-35cf-11e9-8fd5-7b032e01228d.png\" alt=\"14\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>The American proposal also had the idea of controlling statements\nby boolean expressions. It didn&#39;t even have an &quot;if&quot; keyword.\nInstead, if an expression was followed by an arrow, the expression controlled\nthe statements that followed the arrow.</p>\n<p>The notation doesn&#39;t make it obvious, but unlike the German block of ifs,\nin the American form, if one expression in a block evaluated to true,\nit did short-circuit and skip the following expressions, like &quot;else if&quot;\ndoes now.</p>\n<ul><li><a href=\"http://www.softwarepreservation.org/projects/ALGOL/report/ACM_ALGOL_Proposal_1958.pdf\" rel=\"nofollow ugc noopener\">http://www.softwarepreservation.org/projects/ALGOL/report/ACM_ALGOL_Proposal_1958.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197122-62e1a180-35ce-11e9-9f26-63c87e6687b4.png\" alt=\"15\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>The two organizations held a joint meeting and merged their proposals\ninto a single document that they called the International Algebraic Language.\nBefore long the language would be renamed to Algol.</p>\n<p>The &quot;if&quot; statement in the combined document looks a lot like the\nGerman proposal, but eliminates the &quot;always&quot; statement to end the block.\nInstead, each &quot;if&quot; stands alone, and if you want multiple statements\nto be controlled by the same expression, you can use &quot;begin&quot; and &quot;end&quot;\nto group them together.</p>\n<p>There is nothing like &quot;else&quot; in this formulation of &quot;if.&quot;</p>\n<ul><li><a href=\"http://www.softwarepreservation.org/projects/ALGOL/report/Algol58_preliminary_report_CACM.pdf\" rel=\"nofollow ugc noopener\">http://www.softwarepreservation.org/projects/ALGOL/report/Algol58_preliminary_report_CACM.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197134-6aa14600-35ce-11e9-9312-9332ca7b8184.png\" alt=\"16\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>However, Algol 58 also had a second conditional form, called &quot;if either.&quot;\nIn this form, you could say &quot;or if&quot; to do the same thing as we now do\nwith &quot;else if.&quot; But there is nothing equivalent to &quot;else&quot; by itself,\nwithout another &quot;if.&quot;</p>\n<ul><li><a href=\"http://www.softwarepreservation.org/projects/ALGOL/report/Algol58_preliminary_report_CACM.pdf\" rel=\"nofollow ugc noopener\">http://www.softwarepreservation.org/projects/ALGOL/report/Algol58_preliminary_report_CACM.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197144-71c85400-35ce-11e9-99ac-1ed3f1dc165c.png\" alt=\"17\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>The story gets muddy the next year, when several papers about Algol\nwere presented at a conference. One of them was the paper where John Backus,\nwho had previously led the Fortran project, introduced the idea of formal\ngrammars for programming languages.</p>\n<p>Algol as he describes it doesn&#39;t have the &quot;if either&quot; conditional form.\nInstead, it has a keyword called &quot;converge,&quot; which makes the top-level\n&quot;ifs&quot; inside its block behave like &quot;else ifs.&quot; It is not clear whether\nthis was meant as an idea for a better &quot;if either,&quot; or whether it was an earlier\nidea that had already been rejected in favor of &quot;if either.&quot;</p>\n<ul><li><a href=\"http://www.softwarepreservation.org/projects/ALGOL/paper/Backus-ICIP-1959.pdf\" rel=\"nofollow ugc noopener\">http://www.softwarepreservation.org/projects/ALGOL/paper/Backus-ICIP-1959.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197164-7bea5280-35ce-11e9-92eb-6dd24abf3967.png\" alt=\"18\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>Either way, &quot;if either&quot; would soon be replaced. In 1957 John McCarthy\nat MIT had written a proposal for the project that became LISP,\nanother extremely old programming language that still survives today.\nHis proposal introduced the idea of the conditional expression,\nas opposed to the conditional statement.</p>\n<p>The important distinction is that an expression must always have a value,\nwhile a statement can simply not be performed if the condition that controls\nit is not true.</p>\n<p>So his &quot;if function&quot; always ends with a clause called &quot;otherwise&quot;\nthat gives the value of the expression when none of the other\nconditions have evaluated to true.</p>\n<ul><li><a href=\"http://www.softwarepreservation.org/projects/LISP/MIT/McCarthy-CC-56.pdf\" rel=\"nofollow ugc noopener\">http://www.softwarepreservation.org/projects/LISP/MIT/McCarthy-CC-56.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53279391-c817be80-36c4-11e9-8fa5-fd1df6942fdf.png\" alt=\"20\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>McCarthy&#39;s conditional expressions inspired Klaus Samelson to clean up\nand unify Algol&#39;s two separate conditional models at the end\nof 1959. He eliminated the entire &quot;if either&quot; form, leaving\nonly the plain &quot;if,&quot; but added a clause called &quot;else&quot; that would\nbe performed when the expression controlling the corresponding &quot;if&quot;\nhad been false.</p>\n<p>You could chain conditions together with &quot;else if,&quot; just like\nthe previous &quot;if either&quot; had allowed with &quot;or if,&quot; but you could\nalso use &quot;else&quot; by itself for a final set of statements that\nwould run if none of the conditions had been true.</p>\n<ul><li><a href=\"https://dl.acm.org/citation.cfm?id=1060889\" rel=\"nofollow ugc noopener\">https://dl.acm.org/citation.cfm?id=1060889</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197180-83116080-35ce-11e9-85c2-ff53a345a4e5.png\" alt=\"20\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>&quot;If-then-else&quot; was the single conditional form that appeared in the Algol 60\nreport the next year, and is the form that almost all subsequent\nprogramming languages have followed.</p>\n<p>Although it seems clear to us now, it was hard for people in 1960 to think about,\nand the report spends a page and a half explaining how it works,\nincluding this arrow diagram.</p>\n<ul><li><a href=\"https://fi.ort.edu.uy/innovaportal/file/20124/1/14-naure_algol60.pdf\" rel=\"nofollow ugc noopener\">https://fi.ort.edu.uy/innovaportal/file/20124/1/14-naure_algol60.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197193-899fd800-35ce-11e9-9605-2da38f85c006.png\" alt=\"21\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>As I mentioned, the use of &quot;else&quot; as a conjuction sounds strange.\nChristopher Strachey&#39;s CPL programming language is the grandparent\nof C and therefore the ancestor of most current programming languages,\nand he refused to use &quot;else,&quot; calling it &quot;ignorantly incorrect English.&quot;\nHe thought we should write &quot;test … then … or&quot; instead, which also\ndoesn&#39;t sound very natural, and didn&#39;t catch on.</p>\n<ul><li><a href=\"http://www.ancientgeek.org.uk/CPL/CPL_Elementary_Programming_Manual.pdf\" rel=\"nofollow ugc noopener\">http://www.ancientgeek.org.uk/CPL/CPL_Elementary_Programming_Manual.pdf</a></li><li><a href=\"https://www.computer.org/csdl/mags/an/2013/03/06231610.pdf\" rel=\"nofollow ugc noopener\">https://www.computer.org/csdl/mags/an/2013/03/06231610.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53197217-91f81300-35ce-11e9-863b-5a017834f510.png\" alt=\"22\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>The MAD programming language also went its own way. It was known\nfor its extremely long keywords, and in addition to using\n&quot;whenever&quot; instead of &quot;if,&quot; it used &quot;otherwise&quot; instead of &quot;else&quot;\nand &quot;or whenever&quot; instead of &quot;else if.&quot;</p>\n<p>It is worth noting the indentation in the MAD manual&#39;s example.\nIt took years before most other programming languages adopted\nthis style of indenting conditions, even though it now\nseems unimaginable to do it any other way.</p>\n<ul><li><a href=\"http://www.bitsavers.org/pdf/univOfMichigan/mad/L2-UOI-MAD1-2-RX_MADum_62.pdf\" rel=\"nofollow ugc noopener\">http://www.bitsavers.org/pdf/univOfMichigan/mad/L2-UOI-MAD1-2-RX_MADum_62.pdf</a></li></ul>\n<hr />\n<figure><img src=\"https://user-images.githubusercontent.com/1951835/53279397-d1089000-36c4-11e9-8582-fa90f64837a7.png\" alt=\"24\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>But even while CPL and MAD shunned the word &quot;else,&quot; they kept\nthe form and only changed the vocabulary. Language designers still search\nfor the perfect way to write a <code>for</code> loop, but the quest for\nthe perfect conditional form seems to have ended in 1959.\nThank you Klaus Samelson, for giving us a tool to think with\nand a word to puzzle over.</p>\n<ul><li><a href=\"https://www.in.tum.de/en/the-department/history/\" rel=\"nofollow ugc noopener\">https://www.in.tum.de/en/the-department/history/</a></li></ul>","headings":[{"level":1,"text":"If-then-else had to be invented","id":"if-then-else-had-to-be-invented"}]}}