← Back to context

Comment by Dwedit

6 days ago

BASIC had the FOR-NEXT loop back in 1964.

10 FOR N = 1 TO 10

20 PRINT " ";

30 NEXT N

C language would first release in 1972, that had the three-part `for` with assignment, condition, and increment parts.

This reminds me of a little bit of trivia. In very old versions of BASIC, "FORD=STOP" would be parsed as "FOR D = S TO P".

I found that amusing circa 1975.

In Fortran, it is a do-loop :)

  • Fortran has grown a lot over time. If somebody said it don’t have a do loop in 196X, I wouldn’t be too surprised.

    Really it’s just syntactic sugar, just use a goto.

    • FORTRAN IV, at least the version I used on the PDP-11 running RSX, did not have a DO-loop. Just IF and GO TO. But it did have both logical and arithmetic IF.

      1 reply →