Variable declaration reset: Difference between revisions

Content added Content deleted
(K)
Line 435: Line 435:


But of course, there's no variables here.
But of course, there's no variables here.

Longhand loops can be emulated, using lambdas (in which case local variables expire when the lambda exits), but this is not what many programmers would think of as a straightforward longhand loop.

=={{header|Nim}}==
=={{header|Nim}}==
In Nim, a loop create a new block. Variables declared in the loop body are created and initialized at each round: they do not retain the value from one round to the next.
In Nim, a loop create a new block. Variables declared in the loop body are created and initialized at each round: they do not retain the value from one round to the next.