Microsoft® JScript for Statement |
Language Reference Version 1 |
Executes a block of statements for as long as a specified condition is true.
for (initialization; test; increment)
statementThe for statement syntax has these parts:
Part Description initialization An expression. This expression is executed only once, before the loop is executed. test A Boolean expression. If test is true, statement is executed. If test if false, the loop is terminated. increment An expression. The increment expression is executed at the end of every pass through the loop. statement The statement to be executed if test is true. Can be a compound statement.
You usually use a for loop when the loop is to be executed a specific number of times. The following example demonstrates one./* i is set to 0 at start, and is incremented by 1 at the end of each iteration. Loop terminates when i is not less than 10 before a loop iteration. */ for (i = 0; i < 10; i++) { j *= i; }
© 1997 by Microsoft Corporation. All rights reserved.
file: /Techref/language/jscript/js752.htm, 3KB, , updated: 1997/9/30 02:45, local time: 2024/11/16 05:26,
3.145.109.100:LOG IN
|
©2024 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? <A HREF="http://linistepper.com/techref/language/jscript/js752.htm"> for Statement</A> |
Did you find what you needed? |