5 ms·
Agreed. I started to program in BASIC some 7 years before I started to learn English. I had no idea what PRINT or LET meant and was able to program without any
by babuskov 7y ago
Agreed. I started to program in BASIC some 7 years before I started to learn English. I had no idea what PRINT or LET meant and was able to program without any problems.
Hm, even today, I have not idea why "for" is used for loops (?) and I'm using it without any problems.
- jdnenej 7y agoNative English speaker and I also don't really get what "for" was meant to mean. At this point it's probably just something that everyone has memorised and part of history.
- deleted 7y ago[deleted]
- yodsanklai 7y agoI'm not a native speaker, but "perform this task, for i in {1,2,3}" seems to make sense as a prose. At least it does in French, when translated literally.
- krzrak 7y agoThe same in Polish.
- ozzmotik 7y agopersonally as a native speaker it has alwaus made sense to me in the sense of saying "for these given constraints, loop while they are maintained" for the arithmetic style for loop, and "for each of these elements" for the more iterator based style.
- jdnenej 7y agoIn python it makes sense but when you have `for(let i=0; I<length; I++)` it makes less sense
- wongarsu 7y ago"for all i smaller than length, starting at 0". It doesn't really map perfectly because in math you usually don't care about the order, so a for loop actually contains more information than the statement it's trying to mimic.
- Izkata 7y agoAlso native English: For me it's always made sense only with the loop body, as "for these do that" Or more straightforwardly, in a way that can be applied to other English constructs, "do that for this group" It's the same "for" in my head in both those versions.
- trophycase 7y agoHuh? It's pretty common even in basic college math courses to use language like "for every p in Q". It's not like programming invented this usage.
- nindalf 7y agoMy high school teacher had a very legit explanation for the meaning of “for” in that context. But I can’t remember it now. Nowadays I write it because it’s expected, not because there’s a hidden deeper meaning.
- tempguy9999 7y agoHmm, never thought about it either. I'd guess a contraction of "for each value..."
- tuesdayrain 7y agoCould it really be anything else? I always assumed that was the obvious intention there. Never crossed my mind that it could mean anything too different.
- Fordec 7y agoOriginally it was a Anglicization of "für" in German first used in a programming language called Superplan which was then picked up upon by FORTRAN and then it just stuck
- eru 7y agoWell, that doesn't really solve the mystery. The German "für" doesn't have any closer connection with loops than English "for".
- kuschku 7y agoe.g. in Sums or Products, with $$ Σ_(i=0)^(20) x² $$ you'd actually pronounce that as "summe für i = 0 bis 20 von x²", which is a good argument for where it might be from.
- dukoid 7y agohttps://en.wikipedia.org/wiki/Heinz_Rutishauser https://en.wikipedia.org/wiki/Heinz_Rutishauser I don't think it's much more intuitive in German than in English, probably goes back to the "for each" quantor.
- bhaak 7y agoThe for loop is the most unintuitive variant of the possible looping constructs. The others (while do/do while/endless loop) are much more straightforward. We could easily have ended up with another version. I always read it as inspired by "for values of" which at least in German is a common phrase heard in mathematical courses.
- dkersten 7y agoI always translate “for” in my head to: for each item x in... In python is pretty direct: “for x in a” translates for for every x in the collection a, do this code... In C it’s a bit more abstract: “for (i=0; i<10; ++i)” for every i in the range starting at i=0, while it’s less than 10, incrementing... Basically the body establishes a set or collection and the for loop executed the loop body “for” every item in the collection. Modern languages often use foreach or some other slightly more descriptive name.
- jhiesey 7y agoI would guess it comes from calling the universal quantifier ”for all” in logic
- quickthrower2 7y agoYou have high hopes!
- Scarblac 7y agoWhen I was 10, the Dutch language manual for the Commodore 64 explained the pronunciation of "input#", but not that of just "input". So I (unfamiliar with foreign languages) thought that "input" was pronounced as we would in Dutch, while "input#" sounded like what I now know is English. A class mate said his father said they were both pronounced as in English. We had a fight over this in the playground, and I beat him. So I was right. "input" on the Commodore 64 is pronounced like in Dutch.
- 317070 7y agoMy brain is parsing how a Dutch input would sound different in Dutch? "in de put" vs "input" sounds the same, no? What is different?
- ward 7y agoThere is definitely a difference. If you don't hear it, you might be saying one of them incorrectly? Wiktionary has audio files for input (English) and put (Dutch) if you need a comparison. In IPA the difference is ʊ vs ʏ. In terms of describing it to a Dutch person I would say the English u is somewhere between the Dutch u and the Dutch oe sounds.
- Scarblac 7y agoThat's how I pronounced it. English input sounds more like Dutch "inpoet", the manual said input# was pronounced "inpoet-nummer". (edit: long live the Internet, it's on page 135 of the manual here: https://docplayer.nl/11208014-Gebruikershandleiding-nederlands-ce-commodore.html https://docplayer.nl/11208014-Gebruikershandleiding-nederlan... . Nostalgia).
- Vinnl 7y agoIn-poot vs in-puht, roughly.
- deleted 7y ago[deleted]