2 ms·
Shadowing can be useful if you want to make sure the "old" variable is never referenced again in the same scope. The reason why this idiom feels "weird" is tha
by pcwalton 9y ago
Shadowing can be useful if you want to make sure the "old" variable is never referenced again in the same scope.
The reason why this idiom feels "weird" is that the loop construct of the language really ought to automatically make a fresh instance of the loop counter for each trip through the loop.