开发者

VB.Net's For Next

开发者 https://www.devze.com 2023-02-16 12:43 出处:网络
Is there a difference between the开发者_开发百科se? For i = 0 To Something.Length - 1 \'do something

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消