next / next x difference

  • Thread starter Thread starter new q.
  • Start date Start date
N

new q.

I've tried testing this to see if there is any difference but couldn't find
any... is there any difference in doing a For - Next loop with/without a
value after the 'Next' at the end?

e.g. -->
For x in 1 to 10
'statements
Next

versus

For x in 1 to 10
'statements
Next x

thx for any help.

[VB.NET 2003 / .NET 1.1]
 
new q. said:
I've tried testing this to see if there is any difference but couldn't
find
any... is there any difference in doing a For - Next loop with/without
a
value after the 'Next' at the end?

No.
 
readability perhaps ?? although it confused me when i saw it the first
time

regards

Michel Posseth [MCP]
 
m.posseth said:
readability perhaps ?? although it confused me when i saw it the first
time

Personally I prefer 'Next <variable name>' because it's more
self-documenting. However, unfortunately VS.NET 2003 doesn't automatically
rename the variable in the 'Next' line if the loop variable gets renamed,
which will reduce maintainability of the code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top