Talk:Loops/For with a specified step: Difference between revisions

Line 25:
::: My intentions were to ''qualify'' the task requirements, not ''alter'' them. It’s difficult to phrase: I wanted to still permit examples like C, where it is just idiomatic, “normal” to write a conditional expression <tt>i < 10</tt> and statement <tt>i += 2</tt>, because <tt>for</tt>-loops with a step size of <tt>1</tt> look just the same.
::: [[User:Root|Root]] ([[User talk:Root|talk]]) 13:37, 3 February 2021 (UTC)
::::There is a problem with this: even if a language does not have a for/by statement, there may be an idiomatic equivalent that is not a while loop. The most common is probably an iterator/enumerator/generator or whatever you call that, e.g. in Python. Except that the tasks explicitly forbids the case where the enumeration is not suitable to very large ranges, which I suppose means we don't want a solution where we loop other a range that in the background builds a full list of values in memory. Except it's how you do it in R. You also want to delete the R solution? Then we are losing knowledge: how to achieve that task, as idiomatically as possible, even if it's not perfect? [[User:Bastet|Bastet]] ([[User talk:Bastet|talk]]) 16:37, 3 February 2021 (UTC)
175

edits