if...then...else had to be invented (2019)
github.com
github.com
In late 1967, I taught myself to program. I never saw a computer during that time, but my high school owned a IBM 026 Keypunch machine used by the administration to enter data that was sent downtown to the school district that had a computer. I would use the keypunch machine to punch my program onto cards, one card per line of code. A friend of mine would pass them along to be run on the district’s computer.
The programming language that I had available was FORTRAN II. It had the arithmetic if and the goto but no modern if statement. The if looked like this:
IF (2*I - K) 25,35,55
Which meant compute the expression, if the result is negative jump to line with label 25, if result is zero jump to line of code with label 35, and if result is positive jump to line 55.There were no Booleans, no comparison operators, and no modern control structures.
My very first attempt to program was intended to solve linear programming optimization problems using the Simplex algorithm, see [1]. The Simplex method finds optimal solutions to a multi variate linear expression, given a set of constraints expressed as inequalities on linear expressions over subsets of the free variables. I had read a slim book on the Simplex method and naively believed that it was a suitable first program. The turn around time submitting a program for me back then was about one week. Despite this ridiculous first attempt at programming, I scaled back my ambitions and wrote ten or twenty simple programs in FORTRAN without an else before going off to college to study mathematics.
It was a much simpler time to tinker with computers, I was excited to see my programs print simple tabular answers on fanfold paper.
Most German words with the meaning of "otherwise" are pretty long/verbose: "andernfalls" (literally: other-case-d), "ansonsten" (literally: on-others).
"sonst" (short for "ansonsten") might have made an appearance, and I'm struggling to find an English word as short as that (that isn't "else").
This makes less sense, though, in a language that permits fall-through or putting 'default' in the middle of the switch statement.
EDIT: Thinking about it a bit more, "or else" is valid English, although not ususally following "if". More like, "Do this, or else I will...".
Perhaps it was supposed to be "or else", and "or" was already a keyword so we're left with "else"? But it still doesn't follow well from "if" so the bad translation from German (possibly using a dictionary) is still more likely.
“or else
used to say what will happen if another thing does not happen:
We must be there by six, or else we'll miss the beginning”
https://dictionary.cambridge.org/us/dictionary/english/or-el...
It could be that the 'if' is implied if you say 'or else'. But 'otherwise' works fine following 'if' and it would probably have been better if they stuck to that. (Albeit lots more keystrokes - but as keywords go it's shorter than 'instanceof' and people don't complain about that one.)
instanceof is very new. At the time of if/else, there wasn’t anything nearly that long. It’s even too long for a filename on many computers of the era.