As everybody knows (or should if they don’t), a For Loop is a statement in programming languages that allow you to iterate (repeat) a body of statements. That’s what a loop is (repeating a body of statements).
There are three common loops: For Loop, While Loop, and GoTo Loop. Some folks don’t like GoTo loops (because of all the spaghetti it might make).
And so the For Loop is the most common of the three. The For Loop repeats for a certain number of times (for example, 6 times). Because that number can be a variable, your user can specify it. In other words, they can type “9” in your program, and then your For loop can read that variable and repeat 9 times.
A For loop repeats something FOR a certain number of times! You get it? You get where the “For” came from? Excellent! Moving on…
Read about how to create For Loops in Small Basic here: Small Basic: How to Create For Loops
And so that brings us to the question…
Where did For Loops come from?
Well, there were originally three different perspectives on looping a body of code a set number of times…
- FORTRAN – Fathered the Do Loop
- ALGOL – Fathered the For Loop
- COBOL – Mothered the “Perform Varying” loop
Although ALGOL is the least recognized of the three languages, it’s the one that won the “Loop Nomenclature War” and got to decide the term we use the most today… the For Loop.
Now, part of the reason why it won and also why it isn’t as recognizable as a language is because it came last of the three (chronologically). So it didn’t have quite as big of an impact on programming (being a bit of a copy of what was out there), but it also had the chance to think through some key improvements. And Fortran and Cobol have found long lives as they continue to wiggle down their business paths.
See how I used “Mothered” for COBOL and not the others? See what I did there? Well, as you read below, let’s just say you’ll start to have some “Grace” with my puns.
FORTRAN stands for FORmula TRANslating System and was started in 1953 by John Backus at IBM, in New York (the compiler was released in 1957). It was created as an assembly language for their shiny, new (and huge) IBM 704 mainframe computer (more like a whole room by itself). (NASA bought some of these bad boys in the 50s.) It borrowed heavily from the GEORGE compiler of 1952.
It included a bunch of programming concepts we still use today, like If, GoTo, Read, and Print. It also helped popularize loops with the Do Loop.
Read more about how to program Do Loops here: http://www.personal.psu.edu/jhm/f90/lectures/15.html
Enter Grace Hopper, a United States Navy rear admiral (commodore). She was one of the first programmers of the Harvard Mark I computer in 1944! She invented the first compiler, she popularized machine-independent programming languages, and she even started the phrase “debugging” when she physically removed an actual moth from a computer! She even got the US Navy Destroyer USS Hopper named after her! That’s why they called her “Amazing Grace”!
Well, in 1943, Amazing Grace joined the US Navy Reserves, aced school and went to work at Harvard, where she was one of the first programmers on the Harvard Mark I. In 1949 through 54, she went to work at Eckert-Mauchly Computer Corporation, where she helped invent the UNIVAC I, the first compiler, MATH-MATIC, and FLOW-MATIC.
Then, in 1959, the Navy funded her to get together a group of programmers (CODASYL), and together they masterminded COBOL (from Grace’s FLOW-MATIC and IBM’s COMTRAN). Also, Amazing Grace staffed most of this team, so she pretty much (grand)mothered it in!
COBOL stands for COmmon Business-Oriented Language.
Being an assembly language, it has a more complicated take on iterative loops (thus the use of “Perform Varying”). Some people think that 80% of the code in the world is COBOL and it powers the world or something crazy like that. Personally, I prefer using midi-chlorians.
ALGOL stands for ALGOrithmetic Language. It was developed by a committee of American and European scientists who met in Zurich in 1958. A key contributor was (you guessed it) John Backus!
Backus is back (us)!
One member of that committee was Heinz Rutishuaser, who brought in some elements of his Superplan language, including the Für loop, which they renamed to the For Loop in English. They also used the Step and Until delimiters.
So there you go! That’s a shotgun blast of programming history.
Leave a comment to help add some info to this rich history!
And click here to learn about how Small Basic does For Loops: Small Basic: How to Create For Loops
– Ninja Ed