Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scan & Do While
Message
From
13/03/2001 12:30:32
 
 
To
11/02/2001 21:07:23
Agnes Cheng
DynamicTech Consultants Ltd.
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00474863
Message ID:
00484501
Views:
12
Hi Agnes...

The Scan...EndScan is specific used to move the record pointer throught the current table(with out 'Skip' Command) and execute a block of commands for each record that meets the specified condition(s)
Sample:

SCAN
IF Salary>=4000
REPLACE Salary WITH Salary * .10
ENDIF
ENDSCAN

...
The same code sample using DO WHILE...ENDDO

DO WHILE .T.
IF Salary>=4000
REPLACE Salary WITH Salary * .10
ENDIF
SKIP
IF EOF()
EXIT
ELSE
LOOP
ENDDO
ENDDO

Because DO WHILE...ENDDO is used generaly to: Execute a block of statements withing a conditional Loop, The statements placed between DO WHILE...ENDDO are executed while "Do While " is evaluated to true(.T.)

Resume :
Scan...Endscan : For each record in the current table apply this...
Do While...Enddo: While the is set to .T. apply this...

Wilfredo P.
Previous
Reply
Map
View

Click here to load this message in the networking platform