Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Argument starter - The roots of all evil
Message
De
07/09/2004 10:45:20
 
 
À
07/09/2004 10:07:59
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00938079
Message ID:
00939957
Vues:
37
>>Surely you'd use a CASE statement though?
>
>Of course, but I've had cases where it wasn't enough. There may be a number of objects to be created, properties checked, and not all of them are having eliminating conditions, so there's the "heavy checking" phase at the top of the loop, then decision on whether to continue, then the beef.

Then the "heavy" checking is decoupled to a proc/func.
>>>
>>lnLen = ALEN( this.aList, 1)
>>I = 1
>>Do while I <= lnLen ;
>>   and not EMPTY( lcValue)
>>	lcValue = prof_r( This.cSection, "row"+Transform( I), "", "C")
>>	If not Empty( lcValue)
>>		this.alist( I) = lcValue
>>         Else
>>                   I = I + 1
>>	EndIf
>>EndDo
>>
>
>Nice and not too much longer. You forgot one extra line, to initialize the lcValue to something not empty. Still, I'm not convinced that simulated for-endfor loops are better than real ones, just because you don't want to use Exit. If speed was an issue, I'd think twice before doing the test (as simple as empty() function) twice each run of the loop.
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform