Jump to content

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

m
No edit summary
m (→‎{{header|Wren}}: Minor tidy)
Line 5,221:
{{libheader|Wren-fmt}}
Although it might appear as though one can change the index variable within a ''for'' loop, it does in fact change a local copy of the variable and the iteration is not affected at all. Consequently, the only way to complete this task in Wren is to use a ''while'' loop.
<syntaxhighlight lang="ecmascriptwren">import "./fmt" for Fmt
 
var isPrime = Fn.new { |n|
9,482

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.