Elektrine lite

← Feed

@nyx@lgbtqia.space

Post #2087615

2026-05-06 14:52 UTC

@shana@mastodon.gamedev.place not really for loops. In math a sum can and often does go up to infinity, whereas a for loop cannot do that. As an analogy to convey some information is fine, I'm just reminding that it ain't the same thing.

Replies (2)

  • @hjvt@hachyderm.io 2026-05-06 14:58

    @nyx @shana while not quite a for-loop, in lazy languages that have bignums, you could yield partial sums forever, at least until your sum grows to millions of digits

    Open ##2114047

  • @nyx Super nitpickity, if you don't have a stop condition, a for-loop will happily go on until the death of the universe (or your pc, whichever comes first) But in general, the sigma is the abstract definition, the for-loop is a possible concrete implementation of that definition, in a language that the target of this PSA (non mathy programmers) can understand and go "oooh ok I get it now". It would have saved me like half a semester if someone had shown me this up front, no other words needed.

    Open ##2114050