Visual Basic .NET 2003 Language Changes
Although I'll be the
first to suggest it should have been up earlier, I wrote a short article about
the new VB.NET 2003 language features... and it is up on MSDN now.
Comments
- Anonymous
March 27, 2003
Duncan, thanks for the article on language changes. I'm curious about the scope of loop control variables. Given this pseudocode:
<PRE class=code>Dim counter As Integer
For i as Integer = 0 To 10
For j as Integer = 0 to 10
Console.WriteLine(i*j)
Next
Next
</PRE>
will it produce an error? I assume not since the inner loop should be able to access the variable since it's still in the scope of the outer loop. And I would assume that after the inner loop is complete, referencing j would give an error. Would I be correct? - Anonymous
March 27, 2003
Glen...
Yep, you are correct... the inner loop is still within the scope of the outer, so the i variable is valid within the inner loop, but j is not available outside of the inner loop....
hope that is clearer than it seems when I read it...