this post was submitted on 16 Jul 2023
1667 points (96.5% liked)

Memes

46399 readers
2328 users here now

Rules:

  1. Be civil and nice.
  2. Try not to excessively repost, as a rule of thumb, wait at least 2 months to do it if you have to.

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 36 points 2 years ago (2 children)

Yea that's not explained better than a math teach. They just swapped notation common in math, for notation common in one specific programming language. it's only easier for the audience who happens to be familiar with programming in general, and that language in particular.

[–] [email protected] 17 points 2 years ago (1 children)

one specific programming language

I think you'd be hard pressed to find someone with any sort of programming background, even just as a hobbyist, who doesn't understand that for loop notation, whether or not they know the specific language it's from. (I couldn't even tell you what specific language that's from, because that notation matches so many different ones.)

I have a 15 year old son; he definitely has not seen summation in math classes yet, but he has far more than enough programming experience (even just from school) to understand the for loop.

[–] [email protected] 2 points 2 years ago (3 children)
[–] [email protected] 3 points 2 years ago

It's any C derivative language.

[–] [email protected] 1 points 2 years ago* (last edited 2 years ago) (1 children)

Java/C# would have types before the variables:

double sum = 0d;
for (int i = 0; i < 4; i++)
	sum += 3 * i;
[–] [email protected] 3 points 2 years ago

Only if they're declared in the snippet.

[–] [email protected] 1 points 2 years ago (1 children)

Could also be Javascript or C#.

[–] [email protected] 2 points 2 years ago
[–] [email protected] 6 points 2 years ago

I think the concept of a for loop is easier to learn, even for non-programmers, as biased as I may be.