In my Programming Language Concepts class it was mentioned in passing that Fortran's original control structures were insufficient. It was alluded that they were too similar to machine instructions for the IBM 704. Was this the case? What exactly made them insufficient?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Well let's see early versions of Fortran had
There were several variations on IF and GOTO including ASSIGNED GOTOs and computed GOTO which was sort of like a CASE statement.
So apart from the DO loops all the control statements were variations on IF and GOTO involving hard coded statement numbers. The result was more vermicelli than spaghetti.
The DO loop itself was problematic in that it was strictly "do until" with the test at the bottom of the loop, so there was no way to skip the first iteration other than preceding it with yet another "IF (cond) GOTO 9999".
So as most control structures were "GOTO linenumber" any substantial change to the code would involve lots error prone changes to the target line numbers.
The DO loop needed to be supplemented with a GOTO to turn it into a DO WHILE.
The earliest Fotrans had a "GOTO" of the form.
Which meant if VAR is <0 then go to statement 100. If = 0 then statement 200, if > 0 then statement 300.
On the whole it was not too bad an attempt. The fact that you could write formulas that looked similar to what you professor wrote on the blackboard was the killer feature of FORTRAN, the program flow had to wait a few years to catch up.
The bad thing about FORTRAN IV was that all control "structures" (including loops) depended on labels. So they provided unstructured control. They were too powerful. How about, for example branching into a label inside a loop and then, later, branching out again ...