please dont rip this site
Microsoft® Visual Basic® Scripting Edition
For...Next Statement
Language Reference |

See Also


Description
Repeats a group of statements a specified number of times.

Syntax
For counter = start To end [Step step]
    [statements]
    [Exit For]
    [statements]
Next

The For...Next statement syntax has these parts:

Part Description
counter Numeric variable used as a loop counter. The variable can't be an array element or an element of a user-defined type.
start Initial value of counter.
end Final value of counter.
step Amount counter is changed each time through the loop. If not specified, step defaults to one.
statements One or more statements between For and Next that are executed the specified number of times.
Remarks
The step argument can be either positive or negative. The value of the step argument determines loop processing as follows:

Value Loop executes if
Positive or 0 counter <= end
Negative counter >= end

Once the loop starts and all statements in the loop have executed, step is added to counter. At this point, either the statements in the loop execute again (based on the same test that caused the loop to execute initially), or the loop is exited and execution continues with the statement following the Next statement.


Tip  Changing the value of counter while inside a loop can make it more difficult to read and debug your code.

The Exit For can only be used within a For Each...Next or For...Next control structure to provide an alternate way to exit. Any number of Exit For statements may be placed anywhere in the loop. The Exit For is often used with the evaluation of some condition (for example, If...Then), and transfers control to the statement immediately following Next.

You can nest For...Next loops by placing one For...Next loop within another. Give each loop a unique variable name as its counter. The following construction is correct:

For I = 1 To 10
    For J = 1 To 10
        For K = 1 To 10
        . . .
        Next
    Next
Next

© 1996 by Microsoft Corporation.

See also:


file: /Techref/language/asp/vbs/vbscript/373.htm, 5KB, , updated: 1996/11/22 10:12, local time: 2018/12/18 20:40,
TOP NEW HELP FIND: 
54.172.40.93:LOG IN

 ©2018 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF="http://www.piclist.com/techref/language/asp/vbs/vbscript/373.htm"> Microsoft&#174; Visual Basic&#174; Scripting Edition </A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2018 contributors:
o List host: MIT, Site host massmind.org, Top posters @20181218 RussellMc, Van Horn, David, Sean Breheny, David C Brown, Neil, Isaac M. Bavaresco, Bob Blick, Harold Hallikainen, AB Pearce - UKRI STFC, John Gardner,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .