I have code as follows (yes, it's pseudo-code).
[VBA]
For i = 1 to 5
Dim j As Integer
' j = 0
j = j + 1
MsgBox j
Next i
[/VBA]
I'd expect one and the same value to be redisplayed all the five times. It doesn't happen; the j grows gibber for every loop-run.
Now, in ANY normally working and self-respecting language i've ever met, the variable j will be out of scope at the end of the loop-run. Not in VB. On the other hand, the complainer does compile the code and let's me (re?)declare the variable... That's a new one too...
What's going on here? Is the variable redeclared at every loop-run and if so - why does it retain it's value, if not - why doesn't it nag?!