Loops/Increment loop index within loop body: Difference between revisions
Content added Content deleted
m (→{{header|J}}) |
|||
Line 2,502: | Line 2,502: | ||
42 99504028301131 |
42 99504028301131 |
||
</syntaxhighlight> |
</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): |
A variant derived from the python solution (except this loop returns the list of computed values rather than displays them): |