Database development and training for Birmingham and the midlands
Specialists in Microsoft Access and Visual Foxpro database training and development
I am happy to hear from existing clients but I am taking no new calls.
For loops in C# and VFP
VFPFor, Step, Loop, Exit, Next, EndFor
Both FoxPro and C# have loops which will run for a certain number of iterations but the syntax is very different.
C# Syntax Notes
The C# loop starts with the for and this is followed by three expressions in brackets:
In this example:
- the first expression initialises the loop counter to 1
- the second expression controls the loop, running so long as i is less than 10
- the third expression increments the counter by 1 at each iteration
Note that the loop counter i has been declared inside the loop control structure. It cannot be accessed from any code outside of the structure.
VFP Syntax Notes
Visual FoxPro uses the same syntax as Visual Basic. Original versions of FoxPro used to end the structure with an EndFor but VFP now accepts the same Next clause as VBA.
Visual FoxPro also has a For Each structure for working with arrays and collections.