Loops/Increment loop index within loop body: Difference between revisions
Content added Content deleted
ReeceGoding (talk | contribs) (Added R solution) |
m (→{{header|Phix}}: is_prime() now a builtin) |
||
Line 3,101: | Line 3,101: | ||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Phix does not allow for loop variables to be modified, so we must use a while loop and manual increment for this sort of thing |
Phix does not allow for loop variables to be modified, so we must use a while loop and manual increment for this sort of thing. |
||
<lang Phix>atom i=42, n=1 |
<lang Phix>atom i=42, n=1 |
||
while n<=42 do |
while n<=42 do |
||
if |
if is_prime(i) then |
||
printf(1,"n = %-2d %,19d\n", {n, i}) |
printf(1,"n = %-2d %,19d\n", {n, i}) |
||
n += 1 |
n += 1 |