RosettaCodeData/Task/Loops-Increment-loop-index-within-loop-body/Smalltalk/loops-increment-loop-index-within-loop-body.st
2023-07-01 13:44:08 -04:00

11 lines
261 B
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.