Loops/Increment loop index within loop body: Difference between revisions
Loops/Increment loop index within loop body (view source)
Revision as of 10:35, 24 January 2023
, 1 year ago→{{header|J}}
m (→{{header|J}}) |
|||
Line 2,502:
42 99504028301131
</syntaxhighlight>
Most of the remainder of this treatment ignores output formatting issues and focuses purely on algorithmic issues.
The loop index from J's <code>for.</code> is read only. But we can use a while loop to achieve the effect of a mutable loop index.
Here are some sketches, starting with that concept and developing some plausible alternative approaches:
A variant derived from the python solution (except this loop returns the list of computed values rather than displays them):
|