← Back to context

Comment by titanomachy

6 days ago

That's a great question. The first language I learned was python, and "for i in range(10)" makes a lot of sense to me. But "for (int i = 0; i < 10; i++)" must have come first, and in that case "for" is a less obvious choice.

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.

FOR comes from ALGOL in which as far as I know is was spelled:

    for p := x step d until n do