Home All Groups Group Topic Archive Search About

next / next x difference

Author
14 Jan 2006 7:17 PM
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]

Author
14 Jan 2006 7:23 PM
Herfried K. Wagner [MVP]
"new q." <nom***@nomail.com> schrieb:
> 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.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
14 Jan 2006 8:51 PM
m.posseth
readability  perhaps ??   although it confused me when i saw it the first
time

regards

Michel Posseth   [MCP]



Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:O1z4s$TGGHA.3984@TK2MSFTNGP14.phx.gbl...
> "new q." <nom***@nomail.com> schrieb:
>> 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.
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>
Author
14 Jan 2006 11:15 PM
Herfried K. Wagner [MVP]
"m.posseth" <mich***@nohausystems.nl> schrieb:
> 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.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>