VB.Net's For Next
Is there a difference between the开发者_开发百科se?
For i = 0 To Something.Length - 1
'do something
Next
For i = 0 To Something.Length - 1
'do something
Next i
It is only for readability:
You can optionally specify counter in the Next statement. This improves the readability of your program, especially if you have nested For loops. You must specify the same variable as the one that appears in the corresponding For statement.
From http://msdn.microsoft.com/en-us/library/5z06z1kb.aspx
Nope. There is no difference. Even with nested loops there is no difference because nested for-loops cannot overlap.
精彩评论