Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scan & Do While
Message
De
13/03/2001 12:30:32
 
 
À
11/02/2001 21:07:23
Agnes Cheng
DynamicTech Consultants Ltd.
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00474863
Message ID:
00484501
Vues:
13
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform