VFP Tutorial - For ... Next loop

Executes a section of code several times. The number of repetitions is controlled by a counter which increases by one each time that the loop executes:

lnLimit = 10
For lnCount = 1 To lnLimit
   * Print the numbers from 1 to lnLimit inclusive
   Print lnCount
Next lnCount

The code in this example will execute ten times and will print the numbers from one to ten.


The Next lnCount marking the end of the structure can be replaced by EndFor but you may find it easier to use the Next option because it is the same form as in Visual Basic and Access.

Back to FoxPro program control .

Introduction | Environment | Project | Tables | Forms | Navigation | Executable

Access Tips

FoxPro Tips

General Tips


Related Items

Visual FoxPro Tutorial - Program control

Program control structures in Visual FOxPro

Read More

Visual FoxPro Tutorial - Do Case

Visual FoxPro Tutorial - Using the Do Case structure to control program execution

Read More

Visual FoxPro Tutorial - Program Code

Visual FoxPro Tutorial - Writing program code

Read More

Visual FoxPro Tutorial - Development Environment

The Integrated Development Environment (IDE) for Visual FoxPro

Read More

Visual FoxPro Tutorial - Build an executable

Visual FoxPro Tutorial - Build a Windows executable from a Foxpro project

Read More