Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Who'd have thought....
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00285125
Message ID:
00285416
Vues:
15
>>Hi Wayne,
>>
>>>This FOR loop would fire???
>>>FOR i = 0 TO 0
>>> WAIT WIND ALLT(STR(i))
>>>ENDFOR
>>
>>Well think of it like this, how many times does "for x = 1 to 2" fire? Twice, right? Well, if you subtract the second term by one, you still be firing it one less. Don't let the Zeros confuse you, its simply a value of the counter.
>
>Mike,
>
>Partially correct, the FOR loop will execute at least once under all conditions. You cannot create a FOR loop that won't run once.

Hi Jim,

Nope, you can. Try this:
lnj = 0
FOR lni = 1 TO 0
  lnj = lnj + 1
NEXT
? lnj && Prints 0
Provided the terminating number is greater than or equal to, or the STEP - clause is included, it will. If, however, STEP isn't included and the terminating value is less than, it won't execute once. It's been this way since at least FPW 2.5.
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform