Loops/Increment loop index within loop body: Difference between revisions

Content added Content deleted
(Loops/Increment loop index within loop body en BASIC256)
Line 3,985: Line 3,985:
n = 42 99504028301131
n = 42 99504028301131
</pre>
</pre>

=={{header|Smalltalk}}==
<lang smalltalk>numFound := 0.
idx := 42.
[:exit |
idx := idx + 1.
idx isPrime ifTrue:[
numFound := numFound + 1.
'%d %20d\n' printf:{numFound . idx} on:Transcript.
idx := idx + idx - 1.
numFound == 42 ifTrue:exit
].
] loopWithExit.</lang>
{{out}}
<pre>1 43
2 89
3 179
4 359
5 719
6 1439
7 2879
8 5779
9 11579
10 23159
11 46327
12 92657
13 185323
...
36 1554750442183
37 3109500884389
38 6219001768781
39 12438003537571
40 24876007075181
41 49752014150467
42 99504028301131</pre>


=={{header|Standard ML}}==
=={{header|Standard ML}}==