[This is preliminary documentation and subject to change]

## Looping

###### Overview

Looping is one of the most important flow-control mechanisms in a programming language. Looping constructs provide the foundation for any application that must repetitively perform a task, such as adding 1 to a variable, reading a text file, or processing an e-mail message and sending it.

###### Code Tour

VBScript and JScript provide several looping mechanisms. This sample demonstrates the three most commonly used looping statements, For ... Next, Do ... Loop, and While ... Wend. These three statements are subtly different, and the scripting situation will frequently dictate which of the three would work best. For the purpose of this sample, however, each type of looping statement is used to accomplish the same task, which is to print a greeting five times using progressively larger font sizes. For each looping statement, the variable i is initialized, and the test condition for the loop is defined such that i will never be greater than 5. The variable is then incremented by 1 for each iteration of the loop.

© 1997-2001 Microsoft Corporation. All rights reserved.