Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loops
Message
De
04/04/2007 11:04:14
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
04/04/2007 08:51:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Loops
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01211796
Message ID:
01212022
Vues:
14
>I think that's bunk.
>To have 'properly designed' (without an EXIT) you simply program the loop to go through all items, probably coding a LOOP to bypass the items you are no longer interested in.
>Which is easier to understand... code that EXITs as soon as it can or code that intentionally loops through the whole entity regardless but ignores lots of items?
>Which is faster... a loop with an EXIT in it or a loop that inspects all items regardless?

I think the only bad case here is a 100m long loop, with Loop and Exit commands scattered at random places. As long as they are neatly stacked on the top, there are no surprises and it's easy to read and debug.

Of course, I'd rather exclude such cases in advance, if possible - in case of a scan, or looping through an array filled via a select statement. But when I cannot avoid that, I have no stomach problems with early exits and loops, just as long as they happen close to the top of the loop.

I do have a problem with a loop which is too long to track. I'd rather move parts of it into subroutines (by any name) just for clarity's sake.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform