Thread: For loops
View Single Post
  #10 (permalink)  
Old 12-03-2008, 7:51 PM
JohnH's Avatar
JohnH JohnH is offline
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,307
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

Quote:
if required loops have finished it avoids 4 because it's done what it has to, if not then 4 tells VB to loop the variable again.

Is that right?
Not exactly, the loop variable name after Next is optional, you can use it to better read when nesting loops. Next is the keyword that ends that loop, same as an If code block ends with "End If". VB is explicit about this to make it easier to read, C style languages for example just denote code blocks starting with a "{" and ending with a "}". So the the Next keyword just tells compiler that this code block was finished and it should do the next For until end condition.
__________________
Reply With Quote