Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Who'd have thought....
Message
De
02/11/1999 10:57:26
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00285125
Message ID:
00285481
Vues:
18
Jim-

>Partially correct, the FOR loop will execute at least once under all conditions. You cannot create a FOR loop that won't run once.

I often rely on a FOR loop to not execute, such as when I've called a function that returns a number (like ASCAN, or AFIELDS, whatever). For example, I made a prg called testy.prg with the following:
SET PROCEDURE TO testy.prg
x = doNothingMuch(0)

FUNCTION DoNothingMuch
LPARAMETER tnNumLoops
LOCAL lni

tnNumLoops = IIF( VARTYPE( tnNumLoops ) = "L", 0, tnNumLoops )

FOR lni = 1 TO tnNumLoops
  WAIT WINDOW "You asked for " + LTRIM( STR( tnNumLoops ) ) + "(" + LTRIM( STR( lni ) ) + ")"
NEXT lni
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform