VFP Tutorial - Scan ... EndScan loop

The scan loop is unique to FoxPro. It processes records in a table and executes the commands within the loop once for every record in the current work area:

* The staff table holds managers and employees
Use Staff In 0

* Modify salaries and bonuses
Scan
   If Title = 'manager'
     * More money for managers
     Replace Salary With Salary * 1.10
     Replace Bonus With 10000
   Else
     * No rise or bonus for the other employees
     Replace Bonus With 0
   EndIf
EndScan

The code in this example will modify every record in the Staff table and reward the managers.

Notes

This example shows how one control structure can be embedded within another. The If structure is executed once for every record in the table.

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