VB.Net for the next

Is there a difference between the two?

For i = 0 To Something.Length - 1
  'do something
Next

For i = 0 To Something.Length - 1
  'do something
Next i
+5
source share
2 answers

It is read-only:

You can specify a 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 in the corresponding For statement.

From http://msdn.microsoft.com/en-us/library/5z06z1kb.aspx

+8
source

Nope. There is no difference. There is no difference even with nested loops, because nested loops cannot overlap.

+1
source

All Articles